How do I get a cell to display the distance to the next filled cell above?

abaabaabaaba4

New Member
Joined
Apr 27, 2014
Messages
4
Hi
So basically I was wondering if there is something I could put into a cell that would show me the number of blank cells above it before the next filled cell so for example
o=empty cell
x=filled cell
Instead of
oooxooo
oxoooox
ooooooo
oooxoox
oxooooo
I would have
oooxooo
oxoooox
ooooooo
ooo3oo2
o3ooooo

For the pieces of data at the top I obviously cant have numbers there as there are no filled cells above them but there is a lot of vertical data where the formula would be used so it would be very helpful if someone could help me.
Thanks in advance.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi there,

Could you explain what means the 3 and 2 on row 4 and row 5, and by the way why on 4th and 7th position of row 4, 2nd position of row 5?

Vândalo
 
Upvote 0
Thanks for taking the time to reply, going left and right is just for a non relevant variable so maybe it would better for the sake of simplicity I just use 1 column in the example. The 3 and the 2 are the distances to the next filled cell above so I want something that when I put this in it will automatically work that out and show the number.
So for the revised example:
x=filled cell
o=empty cell
Example 1)Example 2)Example 3)
For
o o o
x x x
o o x
o x o
x o o
I would have
o o o
x x x
o o 1
o 2 o
3 o o
 
Upvote 0
Let's try this

at the empty cell press alt+shift+= it will automatically write the formula sum(firstcell:lastcell_aboveyourcell). Just replace de sum function with countblank and keep range assumed by the formula plus 1

You will have =countblank(firstcell:lastcell_aboveyourcell)+1

I guess you will achieve your goal.

Vândalo
 
Upvote 0
The command didn't work but I found the auto sum button and it sought of worked, it selected upwards but on cells that were below all the data but when I used it on the cells I wanted it selected the region to the left. I think I'll just manually enter in the distance because this has to have cell locations and be custom to each cell so I may as well just count, thanks anyway for your time.
 
Upvote 0
Welcome to the MrExcel board!

Are the "filled" cells ...
- always filled with numbers,
- always filled with text,
- could be filled with either numbers or text?
 
Upvote 0
I have manually entered all the data so instead if x's it's all numbers now but I would still like to know if there is a formula for when I have to enter in new data.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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