If / Vlookup statement

RichJW

Board Regular
Joined
Jul 7, 2015
Messages
94
Hi,

Ref Excel 2016.
I've been trying to use an IF statement to reference the data in column C, which in turn will change the text in column E.

So, if column C shows the word "Closed", then the text in column E needs to then display the word "Blue".
The difficulty I'm finding in using an IF or Vlookup formula is the ending, as I want all other data in column E to remain. With my formula it is deleting whatever remains in the cell in column E, as not everything in column C equals "Closed". I only wish for the data in column E to change if "Closed" is in column C - everything else in column E needs to stay as it is. There is a changing amount of rows each time.

I'm missing something simple, but cannot quite get it.
If I could add it as a macro, that would be a bonus.

Thanks,
Rich
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello RichJW,

I can suggest to use loop, which will check column C for word "Closed" and input word "Blue" into column E:

Code:
Sub mysub()
Dim rng as Range
Dim cell as Range

Set rng = Activesheet.range("C2:C300") 'Amend range as required for your sheet

For Each cell in rng
If cell.value = "Closed" then
Cell.offset(0,2).value = "Blue"
End If
Next cell
End Sub

See if it helps.
 
Upvote 0
Hi Rich
Your explanation is confusing me :confused:

Is column E plain text or is it a value returned by a formula?
- If it is plain text then you must put your formula in another column and refer to both C and E (or use VBA to replace the text)
- If the value is returned by formula please post the formula
 
Last edited:
Upvote 0
Hi edgarsrom,

That is wonderful and does exactly what I required.
Thanks so much for your help.

Yongle, column E is plain text, sorry if my explanation wasn't good enough - it was confusing me too :)

Cheers all,
Rich
 
Upvote 0

Forum statistics

Threads
1,215,103
Messages
6,123,107
Members
449,096
Latest member
provoking

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top