简体   繁体   中英

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. 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.

For col C: =IFERROR(INDEX(F:F,Match(A1,E:E,0)),"N/A")

For col D: =IFERROR(INDEX(G:G,Match(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. 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   C
3   Y   B
4  N/A N/A
5   G   B
6   B   G
7  N/A N/A

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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