Conditional formatting with an if statement

Iknewthisguy

Active Member
Joined
Jan 22, 2009
Messages
274
Good afternoon,

I'm attempting to conditionally format a cell so if the cell to the immediate left reads "CP" and the cell I'm formatting is empty it's highlighted yellow. If the cell to the immediate left reads "CP" and the cell I'm formatting is anything other than empty it's not highlighted. If the cell to the immediate left is empty then the cell I'm formatting is not highlighted.

Sorry if this is confusing.

Any help would be appreciated.

Thanks.

Chris
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
With cell B1 selected

Format -> Conditional Formatting

"Formula" from the dropdown

=A1="CP"

Format -> Yellow highlight
 
Upvote 0
if the cell you want highlighting is b1 then the conditional format formula would be:
=A1&B1="CP"
 
Upvote 0
I'm attempting to conditionally format a cell so if the cell to the immediate left reads "CP" and the cell I'm formatting is empty it's highlighted yellow. If the cell to the immediate left reads "CP" and the cell I'm formatting is anything other than empty it's not highlighted. If the cell to the immediate left is empty then the cell I'm formatting is not highlighted.

The formula I gave will work fine. Not to cause offense but the formula =and(a1="cp",a2="") will highlight your cell if the cell to the left contains CP and the cell one row down to the left is empty.

So long as you amended that to =and(A1="CP",B2="") then you'll be fine. But like I said =A1&B1="CP" also works. Horses for courses (and I'm lazy and like type less).
 
Last edited:
Upvote 0
The formula I gave will work fine. Not to cause offense but the formula =and(a1="cp",a2="") will highlight your cell if the cell to the left contains CP and the cell one row down to the left is empty.

So long as you amended that to =and(A1="CP",B2="") then you'll be fine. But like I said =A1&B1="CP" also works. Horses for courses (and I'm lazy and like type less).
Quite right. Didn't think it through.
 
Upvote 0

Forum statistics

Threads
1,224,525
Messages
6,179,319
Members
452,905
Latest member
deadwings

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