How to count the number of empty cells above entry...

joezeppy

Board Regular
Joined
Feb 7, 2005
Messages
72
Hi,

I'd like to be able to count the number of empty cells above the cell with the formula in it until a full cell is reached, and then just return that number.

Seems easy enough but I can't think of what function to use.

Any help appreciated.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
joezeppy said:
Hi,

I'd like to be able to count the number of empty cells above the cell with the formula in it until a full cell is reached, and then just return that number.

Seems easy enough but I can't think of what function to use.

Any help appreciated.

Let column A house the entries and the formula of interest.

If entries above the formula cell are numeric...

=ROW()-MATCH(9.99999999999999E+307,$A$1:OFFSET(INDEX(A:A,ROW()),-1,0))-1

which just needs enter.

If entries above the formula cell can be anything...

=ROW()-MATCH(9.99999999999999E+307,1/(1-ISBLANK($A$1:OFFSET(INDEX(A:A,ROW()),-1,0))))-1

which needs be confirmed with control+shift+enter.

Note. I didn't seek to simplify the formulas or look for simpler alternatives if any.
 
Upvote 0
It Worked!

Dear Sir,

It worked.

I apologize for (I guess) a bit of cross posting. Didn't mean to do that.

I just ran across that other guys post after I did mine and the problem sounded similar.

Your solution worked great. I had to tweak it a bit in a very simple way (took out the -1 as the structure of my spread didn't need that).

I'm very impressed.

Now I'm going to have to really try to read that to see how you did it. The only way I ever understand formulas and functions is to say them out loud. LOL.

Thank you very much.

Best Regards,

Joe
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,916
Members
449,093
Latest member
dbomb1414

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