Compare 2 sets of data in EXCEL and return what it should be

jezvanderbrown

New Member
Joined
Nov 26, 2013
Messages
11
Hi everyone


I need some help with comparing 2 sets of data in Excel (see screenshot below).

EXCEL%20SCREENSHOT_zpsbo6msrgm.jpg


As you can see i have data from 2 sources. Source 1 is the correct data. Source 2 may have been correct at some point but its not up-to-date. I want to be able to look at the Account number and Person in Data Source 2 to see if it matches the Account Number and Person in Data Source 1.



  • If it matches then i would like the cell adjacent in column I to remain blank.
  • If it DOES NOT match then i would like to bring the person from Data Source 1 into the cell adjacent in column I

FYI
  • The data starts from row 7 and there could be as many as 5000 Account Numbers
  • If the Account Number in source 2 is not in the list of account numbers in Source 1, then i would like the word CHECK to be inserted into the cell adjacent in column I.
  • I use Excel 2013

Please find a link to a copy of the spreadsheet below (hosted on Google Drive):
https://drive.google.com/file/d/0B0FUMX_fxi4GelBxS0cxTE00eHM/view?usp=sharing

I tried using 'COUNTIFS' which works to a certain extent; it compares whether they match or not but i cant figure out how to do all of the above that i need. I presume a Macro is needed but i have no clue where to start with creating a Macro to do the above.

If someone could help i'd greatly appreciate it!

Thanks in advance
Jeremy
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
try using
=IFERROR(IF(INDEX($C$7:$C$1000,MATCH(F7,$B$7:$B$1000,0))=G7,"",INDEX($C$7:$C$1000,MATCH(F7,$B$7:$B$1000,0))),"check")

if data 2 is blank for account ID
use

=IF(F7="","",IFERROR(IF(INDEX($C$7:$C$1000,MATCH(F7,$B$7:$B$1000,0))=G7,"",INDEX($C$7:$C$1000,MATCH(F7,$B$7:$B$1000,0))),"check"))
 
Last edited:
Upvote 0
In I7, copied down:

=IFNA(IF(VLOOKUP(F7,$B$7:$C$22,2)=G7,"",VLOOKUP(F7,$B$7:$C$22,2)),"check")

Extend the array to suit.
 
Last edited:
Upvote 0
I don't think you need a macro.

What you need is the MATCH function. It searches a range for a value, and returns the location relative to that range.

This should work, if your sheet is formatted just like the picture:

Code:
=IF(ISERROR(MATCH(F7,$B$7:$B$22,0)),"CHECK",OFFSET($B$7,MATCH(F7,$B$7:$B$22,0)-1,2))

Put that in I7, replace both B22's with however many rows you have. And then copy all the way down.

The IF ISERROR part, finds when an account number is not found to put "CHECK".
 
Upvote 0
Hello,

You don't need macro for this. Try this formula:

Excel 2007
Worksheet Formulas
CellFormula
I7=IF(ISERROR(MATCH($A7,$D:$D,0)),"Check",IF($B7=INDEX($E:$E,MATCH($A7,$D:$D,0)),"",IF($B7<>INDEX($E:$E,MATCH($A7,$D:$D,0)),$B7)))

<tbody>
</tbody>

<tbody>
</tbody>


- column A contains SRC1 account no.
- column B contains SRC1 persons
- column D contains SRC2 account no.
- column E contains SRC2 persons

What this formula does is:
1) using MATCH function checks if account no. from SRC1 exists in SRC2. If not MATCH will return an error which is TRUE for ISERROR function. Therefore first IF will return CHECK
2) Second IF will take account no. from current row in SRC1, check for its position in SRC2 with MATCH and using INDEX will return PERSON. Then it will compare PERSON from current row with PERSON returned by INDEX. If they are equal it will leave cell empty in column I
3) Third IF will do almost the same as second IF but it will check if returned PERSONS are different. If yes it will return PERSON from SRC1 (column B)
 
Last edited:
Upvote 0
Thanks everyone for your replies, they all pretty much do what i need so thank you very much for your help! really appreciate it!!

Jeremy
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,851
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top