If(and Statement in Conditional formatting

smalik

Board Regular
Joined
Oct 26, 2006
Messages
180
Office Version
  1. 365
Platform
  1. Windows
Can someone please help me write the correct syntax for an "If(and" statement for conditional formatting.

I am trying to highlight cell B1 in Yellow if the value in cell A1 = "Business" and B2 = Blank.

This is the syntax I am using keep my curser in Cell B1
=if(and(A1="Business",B1=""),TRUE,FALSE) Then I used the formatting to pick the yellow color

Excel does not give me any errors with they syntax, but it does not format the shading.

What am I doing wrong?

Thanks.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Simply =AND(A1="Business",B1="")

If you use the formula you are trying, you should add to it:
=if(and(A1="Business",B1=""),TRUE,FALSE)=TRUE
 
Upvote 0
Solution
No need for the IF you can just use
Excel Formula:
=AND(A1="Business",B1="")
 
Upvote 0
Still not working. Is it because I have a formula in B1 that is pulling a value from another tab?

In addition, I have three other conditional formatting rules that are working perfectly fine.
If A1 = "Individual", Then B1 is shaded gray - works fine
If Len(B1)<4, Then B1 is shaded yellow - works fine
If B1 = 9999, then B1 is shaded yellow - works fine

Combining the statement with another cell is not working.
I tried adding a helper column and wrote the if statement but my if and statement did not work there either.

Inserted a helper column B. The formula in B1 now states =If(and(A1 = "Business", C1=""),"Yes", "No"). I get a value of "No" irrespective if the criteria is met or not.
 
Upvote 0
I think, there is something wrong with the particular spreadsheet. I just wrote the "if(and" formula in a new spreadsheet (same workbook) and it worked. The conditional formatting formulas shared above also worked.

Sorry... the XCL2BB addon does not work on me as I am using a company computer without admin access. I am marking this a solve because the provided solution works.... It just does not work in that specific worksheet
 
Upvote 0
@dreid1011 , @Fluff

I think I figured out the problem. This is happening because of the formula I asked yesterday about "Dynamic Change the Xlookup Return Array" formula

I am using this formula in my input cell.

C5 =INDEX(List!$A$2:$AH$1000,XMATCH($B5,List!$B$2:$B$1000),XMATCH(C$4,List!$A$1:$AH$1))​


If I use a helper Column D and write a formula in Cell D5 as "=C5" I get the same value in both cells (C5 & D5). However, by referencing Cell D5, instead of C5, the conditional formatting works and so is the "if(and" statement. I have a feeling that it has something to do with the "Xmatch" function. I figured I let you guys know.
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,970
Members
449,095
Latest member
Mr Hughes

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