Count the number of blank cells until next filled cell is found

Bookender

New Member
Joined
Sep 18, 2013
Messages
47
Okay, so. I have a sheet with data in all sorts of random cells. However, I only need the information from a few specific ones, so, when I import those columns, I get data that's all over the place.

1
Fish
2
Spoon
3
4
Drink
5
6
Tree
7
Shoe
Four
8
Eight
9
10
Night

<TBODY>
</TBODY>



I would like to get this data 'gathered' so that it takes up as little space as possible, while still keeping the different rows apart. And I want to do this with an INDEX command (no arrays, no VBA). I want to do this by having a helper column that does a simple check, and adds one to the number above itself if any of the cells in a row isn't blank; otherwise (and this is where I have trouble), I want it to add the number of blank cells until next non-blank is encountered. So the row with Fish would be 1, the row with Shoe would be 2, and then the row after that would say 4, as it counts the blank cell before Drink - and then the sequence would continue with 6, 7, 8, 10. In order. As demonstrated:
1
2
4
6
7
8
10

<TBODY>
</TBODY>


Anyone got any ideas for how to do that counting? (my apologies if this exact question has already been answered, but an intial search did not yield anything I could use)
 
An additional thank you, Oldbrewer, for teaching me about OFFSET. I've been able to work it into some of my other codes, which, among other things, has cut the calculation time of one spreadsheet nearly in half. :) So, once again, thank you so much.
 
Upvote 0

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
you are welcome = when I was still at work I found offset/match and sumproduct to be extremely useful. Offset match can be used to chart data and by changing just one cell you can change the range charted just like that...
 
Upvote 0

Forum statistics

Threads
1,215,385
Messages
6,124,626
Members
449,174
Latest member
Anniewonder

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