# Checking a Range in an If statement

#### mlopes1

##### Board Regular
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.

Mark

### Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
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

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.

Mark

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

will give you an X even when C126:130 houses at least a blank.

I did not even consider using the CountA feature. That works perfectly. Thank you again, as usual, very helpful!

Mark

Replies
6
Views
429
Replies
4
Views
416
Replies
3
Views
592
Replies
4
Views
1K
Replies
27
Views
903

1,220,951
Messages
6,157,030
Members
451,392
Latest member
malcv

### 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?

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