count executive zero values within a columns of numbers

tsejoe

New Member
Joined
Jul 2, 2015
Messages
38
Hi There,

I have a data file in excel with the format below. I would like to know the Excel formula so that i can count the number of consecutive 0 to identify number of months no sales per item from the right. Any idea please?


Format:

Item Mth12 Mth11 Mth10 Mth9 Mth8 Mth7 Mth6 Mth5 Mth4 Mth3 Mth2 Mth1 Mth0 Expected Result
A 10 2 1 3 3 4 0 0 0 0 0 0 0 7
B 1 1 0 1 2 1 1 1 1 2 1 0 0 2
C 2 2 2 2 1 3 3 2 1 1 1 1 2 0

Thank you so much - much appreciated.


Best Regards,
Joe
 
Last edited:

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
O2, control+shift+enter, not just enter, and copy down

=MAX(FREQUENCY(IF(B2:N2=0,COLUMN(B2:N2)),IF(1-(B2:N2=0),COLUMN(B2:N2))))
 
Upvote 0
What is the expected result for..


A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
1
Item​
Mth12​
Mth11​
Mth10​
Mth9​
Mth8​
Mth7​
Mth6​
Mth5​
Mth4​
Mth3​
Mth2​
Mth1​
Mth0​
Expected Result​
2
A​
2​
2​
0​
0​
0​
0​
4​
2​
1​
2​
2​
0​
0​
?​

<tbody>
</tbody>

M.
 
Upvote 0
HI M,

it should be 2, expect the formula to always count from the right-hand-side towards the left, as soon as it find the next cell is greater than 0, it will be count up to the cell(s) to the right and stop.

Thanks very much

Best Regards,
Joe
 
Upvote 0
HI M,

it should be 2, expect the formula to always count from the right-hand-side towards the left, as soon as it find the next cell is greater than 0, it will be count up to the cell(s) to the right and stop.

Thanks very much

Best Regards,
Joe


See post #2...
 
Upvote 0
HI M,

it should be 2, expect the formula to always count from the right-hand-side towards the left, as soon as it find the next cell is greater than 0, it will be count up to the cell(s) to the right and stop.

Hi Joe

Maybe this


A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
1
Item​
Mth12​
Mth11​
Mth10​
Mth9​
Mth8​
Mth7​
Mth6​
Mth5​
Mth4​
Mth3​
Mth2​
Mth1​
Mth0​
Expected Result​
2
A​
10​
2​
1​
3​
3​
4​
0​
0​
0​
0​
0​
0​
0​
7​
3
B​
1​
1​
0​
1​
2​
1​
1​
1​
1​
2​
1​
0​
0​
2​
4
C​
2​
2​
2​
2​
1​
3​
3​
2​
1​
1​
1​
1​
2​
0​
5
D​
2​
2​
0​
0​
0​
0​
4​
2​
1​
2​
2​
0​
0​
2​

Formula in O2 copied down
=COUNTIF(INDEX($B2:$N2,LOOKUP(2,1/($B2:$N2>0),COLUMN($B2:$N2)-COLUMN($B2)+1)):$N2,0)

Hope this helps

M.
 
Upvote 0

Forum statistics

Threads
1,214,834
Messages
6,121,873
Members
449,056
Latest member
ruhulaminappu

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