简体   繁体   English

根据特定列中的值填充空行

[英]Populate empty rows based on values in specific columns

I have a sheet that contains the customer code, store name, street and city and some other columns.我有一张包含客户代码、商店名称、街道和城市以及其他一些列的表格。 The problem is that some of the columns are blank because some data were copied from elsewhere.问题是某些列是空白的,因为某些数据是从其他地方复制的。 For example:例如:

Code代码 Name姓名 Street街道 Ort奥尔特 City城市
1111 1111 Shop1店铺1 Felder Str.费尔德海峡 3278 3278 Herslden赫斯登
Shop1店铺1 Herslden赫斯登
1211 1211 ShopX商店X Walkt Str.步行街。 4414 4414 Windsheld风挡
Shop X商店 X Windsheld风挡

I want to be able to populate the empty columns based on the "Name1" and "Ort" columns.我希望能够根据“Name1”和“Ort”列填充空列。 So for example, if 'Name' is "Shop 1" and City is "Herslden", copy the content of its Code, Street and Ort columns into the ones which are empty.例如,如果“名称”是“Shop 1”,城市是“Herslden”,则将其 Code、Street 和 Ort 列的内容复制到空的列中。 In the end, have something like:最后,有类似的东西:

Code代码 Name姓名 Street街道 Ort奥尔特 City城市
1111 1111 Shop1店铺1 Felder Str.费尔德海峡 3278 3278 Herslden赫斯登
1111 1111 Shop1店铺1 Felder Str.费尔德海峡 3278 3278 Herslden赫斯登
1211 1211 ShopX商店X Walkt Str.步行街。 4414 4414 Windsheld风挡
1211 1211 ShopX商店X Walkt Str.步行街。 4414 4414 Windsheld风挡

I was thinking there should be a way to do this using Excel formula or python.我在想应该有一种方法可以使用 Excel 公式或 python 来做到这一点。 I have thousands of rows and to do them manually might take the whole day.我有数千行,手动完成可能需要一整天。

Dirty but effective and easy way would be just duplicating the data and copy/paste them as values肮脏但有效且简单的方法就是复制数据并将它们复制/粘贴为值

在此处输入图像描述

You'll need to copy headers as well.您还需要复制标题。 Formula is just =IF(A2="";A1;A2)公式就是=IF(A2="";A1;A2)

As I said, it's dirty but easy and works good正如我所说,它很脏但很容易并且效果很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM