Checking a Range in an If statement

mlopes1

Board Regular
Joined
Jul 14, 2002
Messages
114
I have the following formula in cell A1 to check if cells C126:130 are all blank:


=IF((ISBLANK(C126)*AND(ISBLANK(C127)*AND(ISBLANK(C128)*AND(ISBLANK(C129)*AND(ISBLANK(C130)))))),"X","Y")

The formula works correctly but is there a way to reference all 5 cells, i.e. (ISBLANK(C126:130)) rather than nesting the AND statements? I tried using the (C126:130) in the AND argument but then it was only working correctly when C126 was not blank.

Thanks in advance,

Mark
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
If the cells are truely Blank, why not use

=IF(COUNTA(C126:C130)=0,"X","Y")
This message was edited by lenze on 2002-08-28 08:39
 
Upvote 0
On 2002-08-28 08:30, mlopes1 wrote:
I have the following formula in cell A1 to check if cells C126:130 are all blank:


=IF((ISBLANK(C126)*AND(ISBLANK(C127)*AND(ISBLANK(C128)*AND(ISBLANK(C129)*AND(ISBLANK(C130)))))),"X","Y")

The formula works correctly but is there a way to reference all 5 cells, i.e. (ISBLANK(C126:130)) rather than nesting the AND statements? I tried using the (C126:130) in the AND argument but then it was only working correctly when C126 was not blank.

Thanks in advance,

Mark

=IF(COUNTBLANK(C126:130),"X","Y")

will give you an X even when C126:130 houses at least a blank.
 
Upvote 0
I did not even consider using the CountA feature. That works perfectly. Thank you again, as usual, very helpful!

Mark
 
Upvote 0

Forum statistics

Threads
1,214,822
Messages
6,121,765
Members
449,049
Latest member
greyangel23

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