Count how many blank cells before cell value

bluefeather8989

Active Member
Joined
Nov 20, 2009
Messages
325
Office Version
  1. 365
Platform
  1. Windows
I need a formula that will Count how many blank cells before cell value.
Example R15:R21 there are 2 blanks before the cell R17 with a value .

1698552244085.png
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Try this in S17 and below - But it has some limitations. It shall count all blanks above the cell

Excel Formula:
=Countifs($R$15:R16,"")
 
Upvote 0
Will there always be at least one cell in R15:R21 that is not blank?

See if this does what you want.
Excel Formula:
=XMATCH("?*",R15:R21&"",2)-1
 
Upvote 2
Solution
Hi @Peter_SSs
Your solution sounded interesting and new to me. So thought giving it a try to learn...

Am I missing something here?

Book2
ABC
1Test
2Test
3Test0
4
5
6Test
7Test
8Test
Sheet1
Cell Formulas
RangeFormula
C3C3=XMATCH("?*",A1:A8&"",2)-1
 
Upvote 0
Am I missing something here?
I believe you are, though the OP can confirm one way or the other.
My reading is that the OP wants to know how many blank cells in the range before a non-blank cell
I need a formula that will Count how many blank cells before cell value.
Example R15:R21 there are 2 blanks before the cell R17 with a value .
In your example there are no blank cells before a cell with value in the range A1:A8 therefore I believe the correct answer is zero as per the formula.
 
Upvote 0
In your example there are no blank cells before a cell with value in the range A1:A8 therefore I believe the correct answer is zero as per the formula.
Interesting. Thanks for reverting. It was useful.
 
Upvote 0
You're welcome. Thanks for the follow-up. :)
 
Upvote 0

Forum statistics

Threads
1,215,243
Messages
6,123,837
Members
449,129
Latest member
krishnamadison

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