Page 1 of 1

HELP: Compare two cols containing text in Excel ROW by ROW?

PostPosted: Tue May 04, 2004 11:17 am
I have an Excel spreadsheet and would like to compare
columns B and E (both contain text strings) on a ROW by ROW basis.

In other words, I only care whether the data in column B row 3
matches column E row 3- I don't care if the same string is on a DIFFERENT row, only if it is on the same row I am currently comparing.
Therefore I don't think a VLOOKUP is the way to go here.

I have looked online for a bit, and tried a simple formula I found on a an Excel forum:
=IF(B3<>E3,"N"," ")
This is supposed to print N if the values don't match.
I couldn't get it to work - it always printed N, even when the text was identical.
I tried using the TEXT and STRING functions, but couldn't get it to work.

Since I am pressed for time, I wanted to ask for help here, rather than spend the next hour looking online.


PostPosted: Tue May 04, 2004 11:28 am
by CowboySlim
Try this:

=IF(NOT(D18=E18), "Not Equal", "Equal")


PostPosted: Tue May 04, 2004 11:36 am
Not to worry, it was because of the leading and trailing spaces
not matching up.
TRIM did the trick.

Thanks anyway!

PostPosted: Tue May 04, 2004 11:38 am
CowboySlim wrote:Try this:

=IF(NOT(D18=E18), "Not Equal", "Equal")


Thanks Slim!
I posted my reply above, without realizing you had replied already.

The problem turned out to be that the leading and trailing spaces were being counted, so there was never a match, since the two spreadsheets the values were copied into one from didn't have the EXACT same formatting.

PostPosted: Tue May 04, 2004 2:17 pm
by CowboySlim
Sometimes copy and paste bring trailing characters into Excel that you don't see, like copy and paste from a cell in a Word document table. That's right then you have to do a character count and a trim, or sometimes I use Right or Left function.