Count "0" after all specific numbers

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
</SPAN></SPAN>Hello,</SPAN></SPAN>

I am looking a specific solution for my need, Count "0" after all specific numbers are listed in cells F5:F24 and result of count show in the cells G5:G24 as shown in the example below...</SPAN></SPAN>

In the data Column D number of sequence is broken by 0's (some time after 1, some time after 2...and so on) I need to count 0's after each sequence has come up (to make example clearer I have filled a different coloured for the last number of each sequence) </SPAN></SPAN>

Here is an example.... with results</SPAN></SPAN>


Book1
ABCDEFG
1
2
3
4n1Count "0" AfterCount Result
5013
6122
7031
8141
9253
10360
11470
12580
13690
148100
159110
1611121
1712130
180140
190150
202160
210171
220180
231190
242200
254
265
270
280
290
301
312
324
330
342
353
364
375
380
390
401
410
421
432
443
454
465
476
487
499
5010
5111
5212
5314
5416
5517
560
571
582
593
600
610
622
630
641
650
661
672
683
694
705
710
721
Sheet1


Thanks In Advance </SPAN></SPAN>
Using version 2000</SPAN></SPAN>

Regards,</SPAN></SPAN>
Moti</SPAN>
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
[Table="width:, class:grid"][tr][td="bgcolor:#C0C0C0"][/td][td="bgcolor:#C0C0C0"]
D​
[/td][td="bgcolor:#C0C0C0"]
F​
[/td][td="bgcolor:#C0C0C0"]
G​
[/td][td="bgcolor:#C0C0C0"]
H​
[/td][/tr][tr][td="bgcolor:#C0C0C0"]
4​
[/td][td="bgcolor:#F3F3F3"]
n1
[/td][td="bgcolor:#F3F3F3"]
Count "0" After
[/td][td="bgcolor:#F3F3F3"]
Count Result
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
5​
[/td][td]
0​
[/td][td]
1​
[/td][td="bgcolor:#E5E5E5"]
3​
[/td][td]G5: =COUNTIFS(D5:D71,F5, D6:D72, 0)[/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
6​
[/td][td]
1​
[/td][td]
2​
[/td][td="bgcolor:#E5E5E5"]
2​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
7​
[/td][td]
0​
[/td][td]
3​
[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
8​
[/td][td]
1​
[/td][td]
4​
[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
9​
[/td][td]
2​
[/td][td]
5​
[/td][td="bgcolor:#E5E5E5"]
3​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
10​
[/td][td]
3​
[/td][td]
6​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
11​
[/td][td]
4​
[/td][td]
7​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
12​
[/td][td]
5​
[/td][td]
8​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
13​
[/td][td]
6​
[/td][td]
9​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
14​
[/td][td]
8​
[/td][td]
10​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
15​
[/td][td]
9​
[/td][td]
11​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
16​
[/td][td]
11​
[/td][td]
12​
[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
17​
[/td][td]
12​
[/td][td]
13​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
18​
[/td][td]
0​
[/td][td]
14​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
19​
[/td][td]
0​
[/td][td]
15​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
20​
[/td][td]
2​
[/td][td]
16​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
21​
[/td][td]
0​
[/td][td]
17​
[/td][td="bgcolor:#E5E5E5"]
1​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
22​
[/td][td]
0​
[/td][td]
18​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
23​
[/td][td]
1​
[/td][td]
19​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
24​
[/td][td]
2​
[/td][td]
20​
[/td][td="bgcolor:#E5E5E5"]
0​
[/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
25​
[/td][td]
4​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
26​
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
27​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
28​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
29​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
30​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
31​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
32​
[/td][td]
4​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
33​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
34​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
35​
[/td][td]
3​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
36​
[/td][td]
4​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
37​
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
38​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
39​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
40​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
41​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
42​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
43​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
44​
[/td][td]
3​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
45​
[/td][td]
4​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
46​
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
47​
[/td][td]
6​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
48​
[/td][td]
7​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
49​
[/td][td]
9​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
50​
[/td][td]
10​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
51​
[/td][td]
11​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
52​
[/td][td]
12​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
53​
[/td][td]
14​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
54​
[/td][td]
16​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
55​
[/td][td]
17​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
56​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
57​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
58​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
59​
[/td][td]
3​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
60​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
61​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
62​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
63​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
64​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
65​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
66​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
67​
[/td][td]
2​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
68​
[/td][td]
3​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
69​
[/td][td]
4​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
70​
[/td][td]
5​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
71​
[/td][td]
0​
[/td][td][/td][td][/td][td][/td][/tr]
[tr][td="bgcolor:#C0C0C0"]
72​
[/td][td]
1​
[/td][td][/td][td][/td][td][/td][/tr]
[/table]
 
Upvote 0
G5: =COUNTIFS(D5:D71,F5, D6:D72, 0)
Thank you shg, for your prompt replay unfortunately in my older version 2000 Function "COUNTIFS" does not works</SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Moti
</SPAN></SPAN>
 
Upvote 0
=sumproduct((D5:D71 = F5) * (D6:D72 = 0))
shg, with this formula I got requested result Perfect! </SPAN></SPAN>

Thank you for your kind help
</SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Moti :)
</SPAN></SPAN>
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,595
Members
452,657
Latest member
giadungthienduyen

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