[英]Excel Formula comparing two columns
Below is a sample of the data I have. 以下是我的数据样本。 I want to match the data in Column A and B. If column B is not matching column A, I want to add a row and copy the data from Column A to B. For example, "4" is missing in column B, so I want to add a space and add "4" to column B so it will match column A. I have a large set of data, so I am trying to find a different way instead of checking for duplicate values in the two columns and manually adding one row at a time.
我想匹配A列和B列中的数据。如果列B与列A不匹配,我想添加一行并将数据从A列复制到B.例如,B列中缺少“4”,所以我想添加一个空格并在列B中添加“4”,这样它就会匹配A列。我有一大堆数据,所以我试图找到一种不同的方法,而不是检查两列中的重复值并手动一次添加一行。 Thanks!
谢谢!
A B C D
3 3 Y B
4 5 G B
5 6 B G
6 8 P G
7 9 Y P
8 11 G Y
9 12 B Y
10
11
12
11
12
I would move col B,C,D to a separate columns, say E,F,G, then using index matches against col A and col B identify which records are missing. 我会将col B,C,D移动到一个单独的列,例如E,F,G,然后使用索引匹配col A和col B来识别哪些记录丢失。
For col C: =IFERROR(INDEX(F:F,Match(A1,E:E,0)),"N/A") 对于col C:= IFERROR(INDEX(F:F,匹配(A1,E:E,0)),“N / A”)
For col D: =IFERROR(INDEX(G:G,Match(A1,E:E,0)),"N/A") 对于col D:= IFERROR(INDEX(G:G,匹配(A1,E:E,0)),“N / A”)
Following this you can filter for C="N/A" to identify cases where a B value is missing for an A value, and manually edit. 在此之后,您可以过滤C =“N / A”以识别A值缺少B值的情况,并手动编辑。 Since you want A & B to be matching here col B is unnecessary, final result w/ removing col B and C->B, D->C:
由于你希望A和B在这里匹配,因此col B是不必要的,最终结果是删除col B和C-> B,D-> C:
A B C
3 Y B
4 N/A N/A
5 G B
6 B G
7 N/A N/A
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.