Conditionally Matching Cells Between Two Columns

8thstphx

New Member
Joined
Jul 8, 2013
Messages
9
Hello,
New user here - I’ve spent a lot of time searching for help but can’t find my exact situation so I’m posting this thread.

I’m trying to determine if a value in a cell from column A is matched in column C, but only under the condition that the associated column B is greater than column D.

I found a good matching formula from an answer to a question on this site, but I think I somehow need to add in an “AND” function to include the check of column B and column D.

Example of the data:

A B C D E F
1 707y 901.0 are3 900
2 765c 901.5 aiof 901
3 851y 902.5 483j 902
4 ahh8 903.0 949v 903
5 aiof 903.5 azn2 904
6 are3 904.0 bhp3 905
7 fkoa 904.5 are3 906
8 Uoin 907
9 707y 908
10 Ern7 909

(Edit: sorry, the above looked like a true table when I typed it out)

The match formula in column E that I am using to initially match the cells in column A with anything in column C is: =IF(ISNA(MATCH(LEFT(A1,4)&"*",C:C,0)),NA(),A1) … (this includes matching the left 4 numbers with wildcards if a cell isn’t just 4 numerals long – sometimes there may be 5 or 6 digits) but now I need the formula to go one step further and if there is a potential match, the value of column B must also be greater than the value of column D in order to be returned in column E as a true match.

From the above data, I expect matches to result in E5 and E6 because they match and the value in column B is greater than in column D for the potential match. There would not be a “match” result in E1, however, because although the value in column A matches with something in column C, the associated value in column B (B1) is not greater than the associated value in column D (D9).

If it helps: This is in reference to a vehicle license plate study where we were stationed at two checkpoints collecting license plates. If a vehicle’s license plate was recorded at both checkpoints, it is a “match”, but in order to weed out duplicate plates, the only way they are a true match is if the timestamp at the second checkpoint is greater than the timestamp at the first checkpoint (this has to be - due travel time).

I also tried using =VLOOKUP(D1,$A:$B,2,0) in column E, after which I could then create another formula in column F to do a greater than comparison and then get my true matches, but I think VLOOKUP requires an exact match and the values won’t always be 4 numerals – sometimes “ahh8” will need to match “ahh87”. One final wrinkle is that there may be multiple duplicates in either column A or C that have allowable (greater than) timestamp values. But that may just complicate it further so I won’t worry about them.

If this is impossible in one forumula, doing multiple forumulas in more than one column is fine. Also, If I can provide more information I’ll be happy to.

I'm using Excel 2010.

Thank you
 
Last edited:

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Here is a table of the data, I tried just editing the above post, but wasn't allowed after 10 minutes.

excel.jpg
 
Upvote 0
Hi and welcome to Mr Excel Forum

Try this formula in E1
=IF(ISNUMBER(MATCH(A1,C:C,0)),IF(B1>INDEX(D:D,MATCH(A1,C:C,0)),"x",""),"")
copy down

M.
 
Upvote 0
Marcelo (or anyone), again, thanks for the help. Could you also help with one more step to my problem?

In the above formula you provided to me, it returns an "x" in column E if there is a true match that meets the criteria. Is there a way to edit the formula for it to return the value of Column D associated with the matched values instead of an "x"?

In other words, in my example above, the final value of E5 would be "901" because A5 matches with C2 AND B5 is greater than D2 (therefore, the number in D2 (901) is the output value in E5).

Thank you for any potential assistance!
 
Upvote 0
Marcelo (or anyone), again, thanks for the help. Could you also help with one more step to my problem?

In the above formula you provided to me, it returns an "x" in column E if there is a true match that meets the criteria. Is there a way to edit the formula for it to return the value of Column D associated with the matched values instead of an "x"?

In other words, in my example above, the final value of E5 would be "901" because A5 matches with C2 AND B5 is greater than D2 (therefore, the number in D2 (901) is the output value in E5).

Thank you for any potential assistance!

Try this in E1
=IF(ISNUMBER(MATCH(A1,C:C,0)),IF(B1>INDEX(D:D,MATCH(A1,C:C,0)),INDEX(D:D,MATCH(A1,C:C,0)),""),"")
copy down

M.
 
Upvote 0
Thank you! I was working on it and came up with the same thing. I'm happy to have the confirmation.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,246
Members
449,075
Latest member
staticfluids

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