forumla that needs more.......

numbers numbers

New Member
Joined
Aug 18, 2008
Messages
3
I am looking for some help on a formula.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
<o:p> </o:p>
purpose time keeping;<o:p></o:p>
User enters hours worked, (column B) program tracks hours worked in the last day, 30 days, 42 days and 90 days.<o:p></o:p>
<o:p> </o:p>
If the user has 5 days off in a row (column Q, zeros when column B has 5 days with zero hours) then the days tracked should reset to just that day and then start accumulating again.<o:p></o:p>
<o:p> </o:p>
current formula
=IF(Q32=0,SUM(B4:B33),B33)<o:p></o:p>
<o:p> </o:p>
problem
The formula that I have, works for the day in question (resetting first day back after five days off, to only the hours worked that day and not an accumulative). <o:p></o:p>
However it is the subsequent days that the problem occurs, because the formula still totals the previous 30 days, not taking into account that the count has been reset. <o:p></o:p>
<o:p> </o:p>
Question
I understand that I need to add something extra, but I just can’t figure it out, any help would be great, and very much appreciated.<o:p></o:p>
<o:p> </o:p>
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi and welcome to MrExcel!

I think you need a helper column so in cell R32 use the following formula:

=IF(Q31=0,1,MIN(30,R31+1)) and copy it up and down - this provides a counter for how many days back you need to look (up to a maximum of 30). A similar formula can be used for the other values (i.e. 42 & 90).

Then use the following formula in row 33 to add the rows you want:
=SUM(OFFSET(B33,1-R33,0,R33)) and copy it up and down. The offset function starts at a cell and selects a range based on how far you want to offset the cell (in this case B33 is selected and then changed by moving up by 1 cell less the value in R33) and the range you want to select (in this case the value in R33). So the formula in row 33 would only sum B33 while the formula in row 44 would sum B33:B34.

I'm not 100% sure but I think this will do what you want.

HTH, Andrew
 
Last edited:
Upvote 0
thats great you got it, took me ages and i still didnt have it pinned. very cool thank you.
one small change
=IF(Q31=0,1,MIN(30,R31+1))
should read
=IF(Q31=0,MIN(30,R31+1),1)
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,716
Members
449,093
Latest member
Mnur

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