Comparing Strings with VBA code

ThatGuyNamedDean

New Member
Joined
Apr 16, 2015
Messages
9
I have a large data set with multiple columns and a significant number of rows. Each column has a string with a number in the same place but the number is different for each column. Due to typo errors I want to compare each column to the first column, which I know is correct. Is there a way for me to compare a cell with the cell next to it but only using a certain part of the text within the cell? An example is posted below of what I'm looking at.

ColumnA - abcd$1$abcd.ABCD


ColumnB - abcd$5$abcd.ABCD


I would ultimately like to write a code to highlight a cell if the number is different from the cell above it or if any of the letters are different from the cell to the left of it.

I've compared two cells before but using the value in the entire cell.

Thank you in advance for your help!
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,728
Office Version
2013
Platform
Windows
If everything in row (2) should be the same as everything in row (1) and
If everything in row (3) should be the same as everything in row (2) and etc. etc.

And if:

If everything in column (2) should be the same as everything in column (1) and
If everything in column (3) should be the same as everything in column (2) etc. etc.

Sounds like to me everything in your entire sheet should be exactly the same
 

ThatGuyNamedDean

New Member
Joined
Apr 16, 2015
Messages
9
Not quite...

Each number is the same in each column and all the letters are the same in each row.

Which means that numbers vary by column and letters vary by row and why I want to compare only the letters to the column next to it and the numbers to the row above it.
 

Watch MrExcel Video

Forum statistics

Threads
1,090,109
Messages
5,412,464
Members
403,428
Latest member
ldmcd

This Week's Hot Topics

Top