Conditional Formating

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a spreadsheet with a worksheet that I would like to check row by row
to see if the value in Column A (1,i) and Column B (2,i) have the sames
values for other rows.

If the values in Column A and Column B match then if Column C (i,3) is blank
and the matching Column C is not blank then insert the value for the other
Column C.

Please help me complete this task.

Thanks,

Example

Column A Column B Column C
123 648 Calif
345 456 Ariz
123 648

Desired Output
Column A Column B Column C
123 648 Calif
345 456 Ariz
123 648 Calif
 
Not with CF, but a macro can

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim iRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 2 To iLastRow 'iLastRow to 1 Step -1
iRow = 0
On Error Resume Next
iRow = .Evaluate("MATCH(1,(A1:A1000=A" & i & ")*(B1:B1000=B" & i
& "),0)")
On Error GoTo 0
If iRow > 0 Then
.Cells(i, "C").Value = .Cells(iRow, "C").Value
End If
Next i

End With

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Not with CF, but a macro can

Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim iRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 2 To iLastRow 'iLastRow to 1 Step -1
iRow = 0
On Error Resume Next
iRow = .Evaluate("MATCH(1,(A1:A1000=A" & i & ")*(B1:B1000=B" & i
& "),0)")
On Error GoTo 0
If iRow > 0 Then
.Cells(i, "C").Value = .Cells(iRow, "C").Value
End If
Next i

End With

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

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

Back
Top