Search code examples
excelcountcell

How can I count non adjacent blank cells in excel?


I am working on a search function that searches a table in another worksheet that contains client information, from a cell using VLOOKUP. I have 5 "search box" cells and want to be able to search by one criteria at a time, but only if the other 4 search Criteria boxes are empty. So if there was text in more than one of the search boxes at once it would return an error message.

I achieved a desirable result in the first box using COUNTBLANK() like so: COUNTBLANK(B5:B8)=4 nesting it in an IF statement in the formula bar

My question is...How can I count the number of nonadjacent blank cells? So I can confirm that they are empty.


Solution

  • you can simply do =countblank(A1)+countblank(b2)+countblank(c3)+countblank(d4)+countblank(e5) as the number of cells you count is not that high