PDA

View Full Version : Conditional Format Macro help



jsayers2869
02-23-2021, 05:15 AM
Hello! I was hoping for some help.

I tried recording a macro for what I wanted but it didn't work out as needed. I am trying to compare two rows of data against one another. I have to annotate any changes I find within the two rows I am comparing. For example Row 1 vs Row 2. Row 3 vs 4 and so on.

As of now, I am manually highlighting the two rows and running a conditional format of duplicate value so only those two rows are compared against one another. Generally, I have anywhere between 500 - 2000 rows within a worksheet which tends to get time consuming. My columns range from A - AR. Is there a macro out there to run a conditional format of duplicate values for every two rows within the worksheet? I am using Excel 2016 if that helps.

jsayers2869
02-23-2021, 05:19 AM
Here is an example (row 92 vs 93. Row 94 vs 95 and so on).
27991

p45cal
02-23-2021, 06:52 AM
I'm assuming you've got headers in row 1 of the sheet and you want tp start comparing thus: rows 2 & 3, rows 4 & 5 etc.
Select the cells A2 to ARn where n is an odd number at the bottom of your range.
Got to conditional formatting (remove anything already there) and use Use a formula to determine which cells to format and use the following formula:
=IF(ISEVEN(ROW()),A2<>A3,A2<>A1)
choose your highlight and OK.
This will compare each cell in the selected area with the one above it or below it depending on whether it's on an odd or even numbered row and highlight if it's different.
If this doesn't work as you want, attach a workbook.