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
31,992
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
31,992
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,501
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,081,563
Messages
5,359,618
Members
400,540
Latest member
JimUSMC

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top