# Adding to existing formula if cells are blank

#### meppwc

##### Well-known Member
I run the following formula down a column of records in row AR
=IF(COUNTIF(lookup!A:A,N2)>0, "Exclude", "Not In Lookup")

I want to add to this formula an additional function that if any cells in column A1 are blank, then do not perform the remainder of the equation.

### Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

#### xenou

##### MrExcel MVP
I want to add to this formula an additional function that if any cells in column A1 are blank, then do not perform the remainder of the equation.

Is this the same column that you are looking up in?
=IF(COUNTIF(lookup!A:A,N2)>0, "Exclude", "Not In Lookup")

I'm not sure I see a solution - normally I'd suggest a dynamic range so you could count the blanks, but usually a dynamic range is based on the count of the values and assumes there are no blanks (!) -- so we end up where we started with the same problem. The entire Column A:A will have blanks in it so we need to know where to cut it off when checking for blanks.

Why would you have blanks in a lookup anyway? Maybe there's a better way to do this. MATCH OR VLOOKUP would search for an exact match, for instance, so you'd know a value was empty if it returned an NA error:

=IF(ISNA(MATCH(N2,Lookup!A:A,0)), "Exclude", "Not In Lookup")

Or if you need those zero counts, then maybe:

=IF(ISNA(MATCH(N2,Lookup!A:A,0)),"oops!",IF(COUNTIF(lookup!A:A,N2)>0, "Exclude", "Zero Count!"))

Last edited:

Replies
2
Views
200
Replies
7
Views
306
Replies
7
Views
141
Replies
14
Views
715
Replies
1
Views
203

1,195,716
Messages
6,011,276
Members
441,598
Latest member
chrispaulpearce

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

### Which adblocker are you using?

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

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