Replace text with conditional formatting over formula

shaun86

New Member
Joined
Oct 20, 2017
Messages
16
Hello, I am attempting to replace text using a conditional format in a cell that is using a formula to generate a text string. Here is my formula:

=IF(A1>"",B1&" "&LEFT(C1,2),"")

Basically it combines text from B1 with the number value from the first part of C1 to create results like "Car 01" or "Car 04"

What I want the conditional format to do is replace any cell that says "Car 04" to "Car 01"

I've tried using a formula condition to format where true =D1="CAR 01", then under Format > Number > Custom entering "Car 04", but it isn't changing. Just curious if I'm missing a step. Is the formula result overriding the condition?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Conditional formatting can't change the value of a cell.
Also custom number formatting only works for numbers, not text
 
Upvote 0
Conditional Formatting does not/can not replace the values returned by cells, only the formatting of the cell.

To do what you want, try updating your formula like this:
Code:
=SUBSTITUTE(IF(A1>"",B1&" "&LEFT(C1,2),""), "Car 04","Car 01")
 
Upvote 0
or amend the formula in the cell to

=IF( IF(A1>"",B1&" "&LEFT(C1,2),"")="Car 04", "Car 01", IF(A1>"",B1&" "&LEFT(C1,2),"") )
 
Last edited:
Upvote 0
Thanks for the response! I will try to come up with another method for this.
Does the formula I posted work for you?
 
Upvote 0
Does the formula I posted work for you?

Yes sorry I was a bit hasty there. It worked perfectly, thank you very much. I have not used the Subtitute function before it is always nice to learn how to use new functions.
 
Last edited:
Upvote 0
You are welcome.
The advantage to using SUBSTITUTE is that you do not need to list your original IF function twice in the revised function.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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