Reset a Counter to zero and continue to count when a specific number is detected.

DarkestValkryie

New Member
Joined
Jun 12, 2018
Messages
5
I am looking for a little help here. I'm not a novice, but I am not an expert either. Just need to resolve one issue. I will include as much info as I can during my explanation.

I am trying to make a "days since" tracker that shows the days since someone has delivered a certain thing. (not using dates just week numbers) like displayed in the table below;
[TABLE="class: grid, width: 907"]
<tbody>[TR]
[TD]Store Name[/TD]
[TD]Region[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]8[/TD]
[TD]9[/TD]
[TD]10[/TD]
[TD]11[/TD]
[TD]12[/TD]
[TD]Store Total[/TD]
[TD]Annual Total[/TD]
[TD]Days Since Last Appr[/TD]
[/TR]
[TR]
[TD]Erdington[/TD]
[TD]DC10[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD] 1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD]3[/TD]
[TD] 0[/TD]
[/TR]
[TR]
[TD]Leamington Spa[/TD]
[TD]DC10[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD] 0[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD]3[/TD]
[TD] 21[/TD]
[/TR]
[TR]
[TD]Coventry Alvis[/TD]
[TD]DC10[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3
[/TD]
[TD]3[/TD]
[TD] 7[/TD]
[/TR]
</tbody>[/TABLE]


I have already worked out how to get the <1 to return as 7 and (=>)1 to return as 0 as well as not recognising a blank cell as anything, I just need to find a way to reset the counter every time (=>)1 is detected.

My formula so far is this (be warned its long)

=IF(ISBLANK(D6),0,IF(D6<1,7,0))+IF(ISBLANK(E6),0,IF(E6<1,7,0))+IF(ISBLANK(F6),0,IF(F6<1,7,0))+IF(ISBLANK(G6),0,IF(G6<1,7,0))+IF(ISBLANK(H6),0,IF(H6<1,7,0))+IF(ISBLANK(I6),0,IF(I6<1,7,0))+IF(ISBLANK(J6),0,IF(J6<1,7,0))+IF(ISBLANK(K6),0,IF(K6<1,7,0))+IF(ISBLANK(L6),0,IF(L6<1,7,0))+IF(ISBLANK(M6),0,IF(M6<1,7,0))+IF(ISBLANK(N6),0,IF(N6<1,7,0))+IF(ISBLANK(O6),0,IF(O6<1,7,0))

This is per cell in the total Column and relates to that row number.

I just need to add the reset count feature to it. Macros are enabled so if I need to insert code that is not going to be a problem I just need it to work and to work in a single cell. I have a grid that does the count for me but that's no use to me. It has to be contained in 1 cell.

Many Thanks in advance.

EDIT:
Also, If I need to use the existing table that works it out across multiple cells as a base for the formula, in order to contain it in one cell then that is fine.
 
Last edited by a moderator:

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.
Try

Excel 2010
ABCDEFGHIJKLMNOPQ
1Store NameRegion123456789101112Store TotalAnnual TotalDays Since Last Appr
2ErdingtonDC100001111330
3Leamington SpaDC1000010003321
4Coventry AlvisDC100001110337
Sheet6
Cell Formulas
RangeFormula
Q2=IFERROR(COUNTIF(INDEX(A2:N2,LOOKUP(2,1/(C2:N2=1),COLUMN(C2:N2))):N2,0)*7,COUNTIF(C2:N2,0)*7)
Q3=IFERROR(COUNTIF(INDEX(A3:N3,LOOKUP(2,1/(C3:N3=1),COLUMN(C3:N3))):N3,0)*7,COUNTIF(C3:N3,0)*7)
Q4=IFERROR(COUNTIF(INDEX(A4:N4,LOOKUP(2,1/(C4:N4=1),COLUMN(C4:N4))):N4,0)*7,COUNTIF(C4:N4,0)*7)
 
Upvote 0
Scott you are an amazing individual. Thank you so much!! you have no idea how long I have been working on this sheet!!! You have my utmost gratitude. Thank you.
 
Upvote 0
New question, same topic. Say I have 4 sheets, one for each quarter, and I want the count from the previous sheet to follow onto the next sheet and then continue counting like before. What formula would I need to put in Q2 on Sheet2 in order to continue with the count whilst taking the previous sheets final result into account??
 
Upvote 0
Does this do what you want?


Excel 2010
ABCDEFGHIJKLMNOPQ
1Store NameRegion123456789101112Store TotalAnnual TotalDays Since Last Appr
2ErdingtonDC100001117330
3Leamington SpaDC1000020003321
4Coventry AlvisDC100001120337
Sheet6
Cell Formulas
RangeFormula
Q2=IFERROR(COUNTIF(INDEX(A2:N2,LOOKUP(2,1/(C2:N2>=1),COLUMN(C2:N2))):N2,0)*7,COUNTIF(C2:N2,0)*7)
Q3=IFERROR(COUNTIF(INDEX(A3:N3,LOOKUP(2,1/(C3:N3>=1),COLUMN(C3:N3))):N3,0)*7,COUNTIF(C3:N3,0)*7)
Q4=IFERROR(COUNTIF(INDEX(A4:N4,LOOKUP(2,1/(C4:N4>=1),COLUMN(C4:N4))):N4,0)*7,COUNTIF(C4:N4,0)*7)
 
Upvote 0
No this just returns 0 and doesn't count 0 as 7. Would probably be a better idea for it to detect between 1 and 5 as the reset point, rather than more than. Thank you for your help btw it is very much appreciated.
 
Upvote 0
Cross posted https://www.excelforum.com/excel-fo...t-counter-for-equal-to-and-more-than-0-a.html

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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