Conditional Formatting using AND and INDIRECT

mumbauer

New Member
Joined
Jan 10, 2012
Messages
5
I'm not sure what's going on here but I'm trying to do conditional formatting that applies to an entire column (that way there are fewer conditional rules), but it only applies to a certain range of cells within that column. So what I did was setup the rule such as:

Applies To:
=$B:$Z

Formula I want to use:
=AND(MOD(ROW()-3,49)=38,INDIRECT("B"&ROW()-4)>=0)

If I copy the entire formula into a cell on the spreadsheet itself, it works just fine returning TRUE and FALSE depending on what row I'm on.

However, the above formatting rule does NOT format ANY row. But if I remove the AND function and the first condition (the one that limits which rows it's actually going to apply to) then it will work...OR if I do NOT use the INDIRECT function then it seems to work, it's some weird combonation of using the two together that is causing it to not evaluate to true.

Oh, and I thought of trying to get the formatting to work with the INDIRECT...then I put in the AND function but the only parameter was the original INDIRECT function (see below)...it stops formatting!
=AND(INDIRECT("B"&ROW()-4)>=0)

Office 2010 on Windows 7 64bit

If an example spreadsheet is needed, let me know and I'll try to come up with something.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Ok, so it should be easy to duplicate this...

New worksheet and starting at A1 put in -1 then go to A2 (and more if you want) and put in positive numbers.

Highlight columns A and do conditional formatting.

The formula is =INDIRECT("A"&ROW())<=0

Change the formatting to put in "fill" (background color). You should now see Cell A1 and any empty cell filled with that color.

Now change the formula by wrapping AND() around it like so:
=AND(INDIRECT("A"&ROW())<=0)

It will no longer do the formatting.
 
Upvote 0
I'm not sure what's going on here but I'm trying to do conditional formatting that applies to an entire column (that way there are fewer conditional rules), but it only applies to a certain range of cells within that column. So what I did was setup the rule such as:

Applies To:
=$B:$Z

Formula I want to use:
=AND(MOD(ROW()-3,49)=38,INDIRECT("B"&ROW()-4)>=0)

If I copy the entire formula into a cell on the spreadsheet itself, it works just fine returning TRUE and FALSE depending on what row I'm on.

However, the above formatting rule does NOT format ANY row. But if I remove the AND function and the first condition (the one that limits which rows it's actually going to apply to) then it will work...OR if I do NOT use the INDIRECT function then it seems to work, it's some weird combonation of using the two together that is causing it to not evaluate to true.

Oh, and I thought of trying to get the formatting to work with the INDIRECT...then I put in the AND function but the only parameter was the original INDIRECT function (see below)...it stops formatting!
=AND(INDIRECT("B"&ROW()-4)>=0)

Office 2010 on Windows 7 64bit

If an example spreadsheet is needed, let me know and I'll try to come up with something.
Hmmm...

I can't explain why that doesn't work. It seems like it should.

This worked for me:

=(MOD(ROW()-3,49)=38)*(INDIRECT("B"&ROW()-4)>=0)
 
Upvote 0
Thank you from 2015! I was trying the same thing and I couldn't figure out why they each worked separately, but not together!
 
Upvote 0

Forum statistics

Threads
1,215,873
Messages
6,127,470
Members
449,384
Latest member
purevega

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