![]() |
Conditional Formating
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 |
Conditional Formating
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) "Joe K." <Joe wrote in message ... 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 |
Conditional Formating
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) "Joe K." <Joe wrote in message ... 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 |
All times are GMT +1. The time now is 04:38 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com