Countif until blank cell reached repeatedly in sheet

Valkyrie_ride

New Member
Joined
Oct 3, 2017
Messages
7
Dear all

Would like to seek help to Countif a range of cells within tables (that are not formatted as tables due to design needs) in an Excel sheet.
The problem is that the tables do not have the same amount of rows, so if we drag the formula down, it will not work. I thought of using OFFSET or INDEX MATCH, but I am not sure how to make use those to achieve what I want.

This is what I hoped to achieve in the 'To calculate' column. You can see that there are two separate tables and I want the countifs to start from the non-blank cells, stop at a blank cell, then re-start from the next non-blank cell.

I would appreciate it if anyone can guide me on this!

LevelsDataTo calculate
B13COUNTIF(B2:B6,">0.39")*0.5
13COUNTIF(B2:B6,">0.39")*0.5
25COUNTIF(B2:B6,">0.39")*0.5
38COUNTIF(B2:B6,">0.39")*0.5
412COUNTIF(B2:B6,">0.39")*0.5
B15COUNTIF(B9:B10,">0.39")*0.5
15COUNTIF(B9:B10,">0.39")*0.5

<tbody>
</tbody>
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I can't help feeling I've over-complicated this!


Book1
ABC
1LevelsDataTo calculate
2B132.5
3132.5
4252.5
5382.5
64122.5
7
8
9B151
10151
Sheet1
Cell Formulas
RangeFormula
C2{=IF($A2="","",COUNTIF(OFFSET($B2,MAX(IF(ROW($A$1:$A$3000)),IF($A$1:$A$3000="Levels",ROW($A$1:$A$3000),IF($A$1:$A$3000="",ROW($A$1:$A$3000)))))-ROW()+1,0,MIN(IF(ROW($A$1:$A$3000)>ROW(),IF($A$1:$A$3000="",ROW($A$1:$A$3000))))-ROW()-(MAX(IF(ROW($A$1:$A$3000)),IF($A$1:$A$3000="Levels",ROW($A$1:$A$3000),IF($A$1:$A$3000="",ROW($A$1:$A$3000)))))-ROW()+1),1),">0.39")*0.5)}
Press CTRL+SHIFT+ENTER to enter array formulas.


WBD
 
Upvote 0
Question:
Is the first value of each table in the Levels column always "B1"?

M.
 
Upvote 0
I don't know what version you're using. Or if a helper column is OK.

Helper, C2 and down =C1+NOT(AND(LEN(B1),LEN(B2)))
then in D2 and down =COUNTIFS(C:C,C2,B:B,">0.39")*0.5

OK?
 
Upvote 0
Hi @Fazza, I am looking into your solution: thank you!

However, I would like to understand what is the use of the helper column: what does it do?

thanks for explaining to a beginner!
 
Upvote 0
Thank you for the explanation!

I tried this but it didn't work... what I am looking for is a result like this:
LevelsDataCalculation
B132.5
132.5
252.5
382.5
4122.5
B151
151

Using your way, I got 3.5 all the way; not sure if I did anything wrong...
 
Upvote 0
Hi,

For me, it is not always B1. For example, in the example above, it's B2 and B9 respectively.

I'm asking about the first value in column A (Levels) for each table (group of cells), not the first cell in column B.
Is it always a text ("B1")?

M.
 
Upvote 0

Forum statistics

Threads
1,215,416
Messages
6,124,772
Members
449,187
Latest member
hermansoa

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