# 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.
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EngineerCommented:
Enter this formula in C2 and copy down

="MEDIUM"&IF(RIGHT(D2,2)="67"," RED","")
Author Commented:
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.
EngineerCommented:
Sub red67()
Dim cel As Range
For Each cel In Range("C:C")
If Right(cel.Offset(, 1), 2) = "67" Then
If Right(cel, 4) <> " RED" Then
cel = cel & " RED"
End If
End If
Next cel
End Sub

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
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
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.