Need formula or VBA count the delays

motilulla

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

Note: Colours in column D are filled just to explain the example purpose </SPAN></SPAN>

In the column D I got some sequence of numbers and I got a formula, which counts the length of 0's in the G6:G19 now I need a formula, which can count delay of the 0's length in H6:H19</SPAN></SPAN>

For example delay of the 0 with length 1, last 0 find in row 59 and the last data row is 65 so from the row "59 to 65" 0 is getting delay 6 </SPAN></SPAN>

For example delay of the 0 with length 2, last 00 find in row 21&22 and the last data row is 65 so from the row "22 to 65" 00 is getting delay 43 and so on for all delays...</SPAN></SPAN>

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


Book1
ABCDEFGH
1
2
3
4
5Of 1'sLength Of 0Count Of 0Delay
60186
712243
82321
9340
10450
1106132
12170
13280
14090
15010110
160110
171120
180130
190140
201
210
220
231
240
251
260
271
280
290
300
310
320
330
341
350
361
370
381
392
403
410
421
432
443
454
460
470
480
490
500
510
520
530
540
550
561
572
583
590
601
612
620
630
640
651
Sheet4
Cell Formulas
RangeFormula
G6{=SUM(0+(FREQUENCY(IF($D$6:$D$65=0,ROW($D$6:$D$65)),IF($D$6:$D$65<>0,ROW($D$6:$D$65)))=F6))}
Press CTRL+SHIFT+ENTER to enter array formulas.


Thank you all</SPAN></SPAN>

Excel 2000</SPAN></SPAN>
Regards,</SPAN></SPAN>
Moti</SPAN></SPAN>
 
Last edited:
Ah, you're right, please add the blue line:

Code:
        Do While va(i + 1, 1) = 0
        x = x + 1: i = i + 1
        [COLOR=#0000ff]If i = n Then Exit Do[/COLOR]
        Loop
Akuini, thank you very much for your kind supports it is working flawless!</SPAN></SPAN>

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

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Akuini, it solved with 0 & 1 but stuck once again under this situation when before 0 or 1 is number, like 1, 2 & 3 instead 0, 0 & 0</SPAN></SPAN>


Book1
ABCD
1
2
3
4
5Of 1's
60
71
82
93
104
110
121
132
140
150
160
171
180
190
201
210
220
231
240
251
260
271
280
290
300
310
320
330
341
350
361
370
381
392
403
410
421
432
443
454
460
470
480
490
500
510
520
530
540
550
561
572
583
590
601
610
621
632
643
650
Answer1


Please can you check it?
</SPAN></SPAN>

Thank you
</SPAN></SPAN>

Kind Regards
</SPAN></SPAN>
Moti
</SPAN></SPAN>
 
Last edited:
Upvote 0
Ah, you're right.
Try this one:

Code:
        Do While va(i + 1, 1) = "0"
        x = x + 1: i = i + 1
        If i >= n Then Exit Do
        Loop
 
Upvote 0
Ah, you're right.
Try this one:

Code:
        Do While va(i + 1, 1) = "0"
        x = x + 1: i = i + 1
        If i >= n Then Exit Do
        Loop
Akuini, Cheers! all worked fine. Thank you so much for your patience and time you took to help me.</SPAN></SPAN>

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

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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