How do I do this: If A+B = D+E, make RED.

D

daniel981

I have 5500 or so rows/lines of data with 5 columns. Column A is
program1's last names, B is program1's first names, C is just a visual
barrier between name sets, D is program2's last names, and finally E is
program2's first names.

The first thing I need to do is space out column D and E to correlate
with column A and B.

For example:

Code:
--------------------

A B C D E ...
1 prog1last prog1first prog2last prog2first
2 Adams Bill Adams Bill
3 Alberts Mary Alberts Mary
4 Bates Joe Becker Frank
5 Becker Frank Bodine Howard
 
G

Guest

Daniel,

You could try this macro solution.

Make a back-up copy of your workbook.
Press Ctrl and F11 to open the Visual Basic Editor.
Select Insert and then Module.
Copy the code below and paste it into the module.
Close the Editor.
Go to Tools > Macro > Macros…
Highlight the macro and click Run.
---------------------------------
Option Explicit
Dim Iloop As Single
Dim RowsA As Single
Dim RowsD As Single
Sub FindMatch()

RowsA = Range("A65536").End(xlUp).Row
RowsD = Range("D65536").End(xlUp).Row
Iloop = 1
Do Until Application.WorksheetFunction.CountA(Range("A" & Iloop & ":E" &
Iloop)) = 0
If Cells(Iloop, "A") & Cells(Iloop, "B") > Cells(Iloop, "D") &
Cells(Iloop, "E") Then
Range("A" & Iloop & ":B" & RowsA).Cut
Range("A" & Iloop + 1).Select
ActiveSheet.Paste
ElseIf Cells(Iloop, "A") & Cells(Iloop, "B") < Cells(Iloop, "D") &
Cells(Iloop, "E") Then
Range("D" & Iloop & ":E" & RowsD).Cut
Range("D" & Iloop + 1).Select
ActiveSheet.Paste
Else
Range("A" & Iloop & ":E" & Iloop).Interior.ColorIndex = 3
End If
RowsA = Range("A65536").End(xlUp).Row
RowsD = Range("d65536").End(xlUp).Row
Iloop = Iloop + 1
Loop
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top