How to Compare 2 excel sheet row wise where order of data is not fixed - excel

Comparing 2 excel sheets where we need to find id and match next column and if difference then highlight the difference cell.
eg;
Sheet 1
123412 Bob Y
112234 Jill Y
998822 Carry Blank
Sheet 2
112234 Jill XX
998822 Carry Blank
123412 Jack ZZ
Here sheet 2, 123412 has different data in col2 and col4
Also, Sheet 2, 112234 has different data in Col3 when compared with sheet1
I need to highlight the cells so that difference can be identified easily.
There is huge amount of data.
Highlight, Sheet2- Jack, ZZ and XX cells and
Sheet1 - Bob, Y, Y(of Jill)

Related

compare 2 excel columns with data in adjacent columns

I have seen a few answers which were close to what I am looking for, but can't quite figure it out. I apologize as I am not a programmer, but am tasked with these types of things periodically.
I have a spreadsheet with data in multiple rows. I would like to compare column A with C and have them align, and then the data in B move with column A. (I can rearrange the columns if need be to make this work.
I have this:
Inventory ID# count Original ID# vendor item number
1234 2 1000 vendor 1 1234566
1456 1 1234 vendor 2 546564
7000 3 1456 vendor 3 af4566
2003 vendor 4 56778
7000 vendor 1 788asd
What I want it to look like is after:
Inventory ID# count Original ID# vendor item number
1000 vendor 1 1234566
1234 2 1234 vendor 2 546564
1456 1 1456 vendor 3 af4566
2003 vendor 4 56778
7000 3 7000 vendor 1 788asd
I have tried macros, and VLOOKUP, but can't figure out how to have the count move with the inventory ID # Thank you for your help.
I'll assume your data starts in Sheet1!A1
Move the Invenotry ID# and count columns to a different sheet (say, Sheet2). Then replace the value in cells A2 with the following:
=IFERROR(VLOOKUP($C2,Sheet2!$A:$B,1,FALSE),"")
and similar for cell B2:
=IFERROR(VLOOKUP($C2,Sheet2!$A:$B,2,FALSE),"")
Fill it down. The VLOOKUP will place your id's and counts in the right rows, and the IFERROR( ... ,"") part will put a blank string where there is no match, so it will look like you desired table
If your data starts from cell A1, insert 2 columns C and D like below,
Enter the below formula in cell C2 and drag it right to column D and then down throughout the range,
=IFERROR(INDEX($A:A,MATCH($E2,$A:$A,0),COLUMN(A1)),"")
You can then copy-pastespecial Column C and D to A and B and delete C and D.

Multiple value VLOOPUP

I've an excel with 2 sheets, the sheet 2 has some KV, my requirement is that, when I enter a key in sheet 1, it should get the corresponding values (spread across many columns & rows).
Sheet2:
A B C D
1 Obj1 Item1 Price1 Qty1
2 Item2 Price2 Qty2
3 Item3 Price3 Qty3
4 Item4 Price4 Qty4
Note: Obj1 is merged for 4 rows in col1.
In Sheet1 if I enter Obj1, I want all the values present in column B, C, D & the rows 1, 2, 3, 4.
I tried the option
{=vlookup("Obj1", Sheet2!A:D, {2,3,4}, false)}
But does not return 3 columns as expected. (I read this method of returning multiple columns in some website)
Kindly help me to resolve this.
Use a helper column:
In E1 put:
=A1
In E2 put
=IF(A2<>"",A2,E1)
Then put this formula in the upper left corner of the desired output range:
=IFERROR(INDEX(B$1:B$4,AGGREGATE(15,6,ROW(B$1:B$4)/($E$1:$E$4=$G$1),ROW(1:1))),"")
Where $G$1 is the location of the Search Criteria.
Then drag/fill this formula across a total of three columns and down enough rows to cover the greatest number of rows that a object can have.
Of course once you have your helper column you can easily use it with filters to output the same thing without the formulas.

Need to match data in different sheets and replace data in another cell if it's a match

I need to match data in column A2 and so on in sheet 1 to data in column A2 and so on in sheet 2. If the data in column A of sheet 1 and sheet 2 match I need the data in column B & C of sheet 2 to replace data in column B & C of sheet 1. I know VERY little about doing this kind of stuff so any help would be GREATLY appreciated!
SHEET 1
A B C
2 12345 5.35 9.95
3 15874 4.22 10.99
4 11111 2.24 5.99
5 98745 5.33 9.95
6 88552 4.24 8.95
SHEET 2
A B C
2 11111 2.09 5.79
3 12345 5.11 9.89
4 88552 4.01 8.79
NEED SHEET 1 to change to
A B C
2 12345 5.11 9.89
3 15874 4.22 10.99
4 11111 2.09 5.79
5 98745 5.33 9.95
6 88552 4.01 8.79
On a third sheet use these functions
column a ='sheet1'!a2
column b =if('sheet1'!b2='sheet2'!b2,'sheet2'!b2,'sheet1'!b2)
column c =if('sheet1'!c2='sheet2'!c2,'sheet2'!c2,'sheet1'!c2)
Copy sheet3 and paste the values into sheet1.
This should work unless column a does match. or if you need to do this dynamically. If column a doesn't match some vlookups can be thrown in.
I your data does match in column a your formulas could look something like this.
column a ='sheet1'!a2
column b =if(not(iserror(vlookup(a2,'sheet2'!a:c,2,false))),vlookup(a2,'sheet2'!a:c,2,false),vlookup(a2,'sheet1'!a:c,2,false))
column c =if(not(iserror(vlookup(a2,'sheet2'!a:c,3,false))),vlookup(a2,'sheet2'!a:c,3,false),vlookup(a2,'sheet1'!a:c,3,false))
this is too much to put in a comment so I'm putting it in answer.
The way I under stand is, since sheet1 has more data, you only want to be doing this comparison when sheet1 and 2 both have data on the row. so If sheet1 has data in rows 1 - 100, and sheet2 has data in rows 1 to 50, you only want to be doing this comparison for the first 50 rows in sheet1 right?
So, rather than copying and pasting formulas, what you can do is, in sheet1, find an unused column. go to the first row. in the formula box, type: "=if(" without the quotes. now, select the first cell to compare, according to your example you'd select sheet1, A2. then type "=" without quotes. then select the second cell you want to compare - in your example, sheet2, A2. then type "," without quotes. then select the cell from which you want the data if the first 2 cells are equal. in your example, sheet2 B2. then type "," without quotes, then select the cell with the data to use if the first 2 cells are not equal. in your example, sheet1 b2. then type ")" without the quotes.
so using your example, the function would look similar to how bigtree had it: =if('sheet1'!A2='sheet2'!A2,'sheet2'!b2,'sheet1'!b2)
so, this will compare sheet1 cell A2 with sheet2 A2 and if they are equal, the cell you put the formula in will the have the value of sheet2 b2, and if they are not equal, the cell with this formula will have the value of sheet1 B2. then, drag this formula down for however many rows you want, and the formula will adjust automatically for each row. you'll see the numbers increase. then, select the column with the formulas, right click and select copy, then right click and go to paste special, and click values. this will make it so the column contains only the values, not the formulas, now you can paste this data in column B sheet 1.
you can reuse this formula for whatever columns, just follow the steps.
HTH, good luck!

How to compare 2 cells to another 2 cells in a different sheet in excel?

I want to know how to compare or know the difference of 2 cells to another 2 cells in a different sheet in excel 2007
Example:
Sheet 1
A B
1 101 KIWI
2 102 APPLE
3 103 BANANA
Sheet 2
A B
1 101 KIWI
2 102 APPLE
3 103 ORANGE
I want to show the there is a difference in 3rd row on Sheet 1 and 2
Thanks
If you put =A1&B1 in C1 of each sheet and copy down then it is like comparing single columns. So with, in D1:
in Sheet1: =MATCH(C1,Sheet2!C:C,0)
in Sheet2: =MATCH(C1,Sheet1!C:C,0)
copied down in each case the resulting numbers should show the row number where the match is on the 'other sheet' (the lists need not be sorted) and otherwise #N/A for where matches have not been found.
There is obviously no need for the concatenation for the example provided, since the two 'A' columns are identical, but I take it that was because the example was simplified.

Compare csv file and Oracle table and highlight differences using Excel

I have a tab seperated csv file of around 50-80 rows (abc.csv) as follows
Column 1 Column 2 Column 3
A 1 XX
B 2 YY
and a table (tblSample1)in Oracle
Tcol 1 Tcol2 Tcol3
A 1 XX
B 2 ZZ
I would like to compare column 2 and 3 and highlight the difference in excel spreadsheet (which in this case is the following)
Column 1 Column 2 Column 3 Tcol 1 Tcol2 Tcol3
B 2 YY B 2 ZZ
What is the easiest way to compare the 2 and highlight the difference using excel vba?
If there are only 50-80 rows, wouldn't a vlookup work?
i.e.
Import both into excel
Use a vlookup to get B 2 YY & B 2 ZZ into a single row
Use a formula like if(a2<>a4, "error", "")

Resources