Adding to existing formula if cells are blank

meppwc

Well-known Member
Joined
May 16, 2003
Messages
604
Office Version
  1. 365
Platform
  1. Windows
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

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
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:
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

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