Conditional formatting formula help

Cliffork

New Member
Joined
Feb 12, 2020
Messages
21
Office Version
  1. 365
I'm trying to basically hide the text of 6 cells if there is a D at the end of cell B15. I've done this in VBA to hide entire rows before, but how the formatting needed to be for this particular page I can't hide the whole row. I need to just make the text invisible if a serial number ends in a D in B15.

My VBA code for a similar thing with the same reference is:
VBA Code:
       If Target.Address(0, 0) = "B15" Then
          With Sheets("Final Insp.")
             If Target.Value Like "*D" Or Target.Value Like "*d" Then
             .Rows("43:48").Hidden = False
I'm just having a hard time wrapping my head around how to write this as a formula. Any ideas?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
To do it in Conditional Formatting, just select the 6 cells you want to apply this to, and then use the following Conditional Formatting formula:
Excel Formula:
=RIGHT(UPPER($B$15),1)="D"
and choose your desired formatting option.
 
Upvote 0
To do it in Conditional Formatting, just select the 6 cells you want to apply this to, and then use the following Conditional Formatting formula:
Excel Formula:
=RIGHT(UPPER($B$15),1)="D"
and choose your desired formatting option.
I can see how this would work, I did forget one detail though. the B15 reference point is in another worksheet in the same document called "Info" How do I make it refer to the B15 in that sheet instead of the current one? Nevermind I figured this part out, I just forgot.

Is there also a way to write the formula so if the cell is lacking a D it formats differently so I can rehide the information?
 
Upvote 0
Just add the sheet reference to your range, like you would do for any other formula in Excel, i.e.
Excel Formula:
=RIGHT(UPPER(Info!$B$15),1)="D"
 
Upvote 1
Solution
Just add the sheet reference to your range, like you would do for any other formula in Excel, i.e.
Excel Formula:
=RIGHT(UPPER(Info!$B$15),1)="D"
Thank you, and it looks like if the D isn't there it just reverts to whatever formatting it had before the conditional formatting took precedent, so I can just set the opposite to what I need for hiding it before entering the Conditions.

Thank you!
 
Upvote 0
Thank you, and it looks like if the D isn't there it just reverts to whatever formatting it had before the conditional formatting took precedent, so I can just set the opposite to what I need for hiding it before entering the Conditions.

Thank you!
Yes, that is how Conditional Formatting works. If the condition is met, it applies whatever formatting you tell it to.
If it is not met, nothing in the cell changes.
 
Upvote 0
FWIW, if you are using Conditional Formatting there is no need for the UPPER() function. This would do exactly the same thing

Excel Formula:
=RIGHT(Info!$B$15,1)="D"
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,217
Members
449,091
Latest member
jeremy_bp001

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