Loop through 2 columns and and return TRUE or FALSE if adjscent cells are matching.

strongman86

Board Regular
Joined
Feb 15, 2017
Messages
95
Hi lads,

Need formula in cell E1 that loops through Columns A & C and if cell value is identical i.e. AB1234X vs AB1234X then it need to compare corresponding adjscent cell values in column B & D to see if they are matching. If they are matching then it needs to return TRUE if not matching then FALSE.



ABCDE
1AB1234X2.40AD2456Y0.24FALSE
2AU1336X1.20AB1234X2.40TRUE
3AD2456Y0.20ZN3590Q1.54TRUE
4TR3456U5.50AU1336X1.20TRUE
5ZN3590Q1.54TR3456U5.52FALSE


<tbody>
</tbody>


Regards,
Strongman86
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,132
Office Version
365
Platform
Windows
How about
=ISNUMBER(MATCH(C2&"|"&D2,INDEX($A$2:$A$6&"|"&$B$2:$B$6,0,0),0))
 

strongman86

Board Regular
Joined
Feb 15, 2017
Messages
95
Hi Fluff, Works ok, but I've noticed sometimes some cells in column C has space after text and then formula doesn't work. Can you amend formula so it looks only for first 7 characters? Thanks.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
30,132
Office Version
365
Platform
Windows
How about
=ISNUMBER(MATCH(LEFT(C2,7)&"|"&D2,INDEX(LEFT($A$2:$A$6,7)&"|"&$B$2:$B$6,0,0),0))
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,395
Office Version
2010
Platform
Windows
Hi Fluff, Works ok, but I've noticed sometimes some cells in column C has space after text and then formula doesn't work. Can you amend formula so it looks only for first 7 characters? Thanks.
If the spaces could only be in Column C (not Column A) then this formula should work for you...

=COUNTIFS(A$1:A$5,TRIM(C1),B$1:B$5,D1)>0

Adjust the 5 in the A$5 and B$5 to be the last row number for your data.
 
Last edited:

Forum statistics

Threads
1,077,678
Messages
5,335,624
Members
399,029
Latest member
JSO

Some videos you may like

This Week's Hot Topics

Top