mato01
asked on
Change value in one cell based on value in another cell
I have a speadsheet where I need to change the value of the cell in Column C, based on the value of the cell in Column D.
Column C cells have a value of Medium. I need to change that cell value to Medium Red if the value of the cell in Column D has a value that ends in 67.
I've attached a sample of the original file, and a sample of the desired results file.
DesiredSpreadsheet.xlsm
OriginalSpreadsheet.xlsm
Column C cells have a value of Medium. I need to change that cell value to Medium Red if the value of the cell in Column D has a value that ends in 67.
I've attached a sample of the original file, and a sample of the desired results file.
DesiredSpreadsheet.xlsm
OriginalSpreadsheet.xlsm
ASKER
Can you convert this statement to vba.
Sometimes there could be more than MEDIUM in the cell, and this method would require me to handle the file.
Sometimes there could be more than MEDIUM in the cell, and this method would require me to handle the file.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Had to change a little, so that it was specific to MEDIUM, but works perfectly. As always thanks a lot.
Sub red67()
Dim cel As Range
For Each cel In Range("C:C")
If cel = "MEDIUM" Then
If Right(cel.Offset(, 1), 2) = "67" Then
If Right(cel, 4) <> "RED" Then
cel = cel & " RED"
End If
End If
End If
Next cel
End Sub
Sub red67()
Dim cel As Range
For Each cel In Range("C:C")
If cel = "MEDIUM" Then
If Right(cel.Offset(, 1), 2) = "67" Then
If Right(cel, 4) <> "RED" Then
cel = cel & " RED"
End If
End If
End If
Next cel
End Sub
="MEDIUM"&IF(RIGHT(D2,2)="