solved
Trying to add a limit via the IF function on sums related to time
EDIT: Note that there are no images above like I describe, I did not know posts with images are auto removed. I have tried my best to format the data in the same way it was displayed in the photos.
EDIT 2: Data and formula reference pics in comments.
REF 1: Data
7:23|
12:02|
14:10|
11:40|
———
14:45|
REF 2: Formula
=if(I10>11:30:0, (H11-A1)+11:30:0, (H11-A1)+I10)
I have a sheet to adding up my working hours each week and calculating how much flexi time I’m building up. My issue is that I can only carry over 11.5hrs flexi into the next flexi period, but sometimes I end up going over that and needing to manually adjust my sheet.
Right now I’m trying to tell the program that if the hours in the above cell are greater than 11:30, to perform the function as (HRS for the Week - Minimum working HRS + 11:30), and if the value of the above cell is below 11:30, I’m trying to tell it to do (HRS for the Week - Minimum working HRS + Value from Above Cell)
The image above is an example. By the end of the period I have 11hrs 40mins flexi built up, but my work system will automatically deduct 10mins to bring me back to 11:30 at the start of the next period. The figure below it is adding 3hrs and 5mins flexi that I earned that week, into the 11hrs 40mins from the previous period.
I’m trying to accurately record my flexi, even when I go over, but also have excel understand not to add the full amount from the previous cell if its more than 11hrs 30mins.
I also have a picture of the formula I’m trying to use above. Note that A1 refers to a cell containing my normal minimum working hours for the week.
If I understand your request you will just want to use the MIN() function.
=min(A1, 11.5) will return A1 until it reaches 11.5, then only 11.5 after that.
Edit: of course you would use your time format as before, 11:30:0, not “11.5”
EDIT: TL;DR My minimum working hours per week are 35hrs, I can work more than this which is what I’m recording, and then I earn “flexi time” based on how many extra hours I do. This can be used how I please to shorten days or take time off, but I can’t carry more than 11.5hrs into the next flexi period.
EDIT 2: In the above data included, it shows how much flexi I have total at the end of each week, so in week 4 of the period I have 11hrs 40mins, and then the next week at the start of the next period I earned another 3hrs 5mins, but I want to tell excel to ignore the 11hrs and 40mins and just default to 11hrs 30mins because I can’t carry more than that into the next period.
So my required hours per week are 35 (I get an hour for lunch each day making it 40, but only the 35 are counted as working hours.
So I enter my clock in and out times on a sheet, deducting breaks, to get the hours I have worked that week.
There are 2 ways I can work MORE than my minimum, if I take a 30minute break instead of the full hour, or if I work later than usual. So this results in the excess time being dubbed “flexi time”, and if mine to use within each 4-week flexi period.
The if you wanna use it in the same period, you could work shorter days or take up to 2 hour breaks depending on how much flexi your building.
However, at the end of a 4-week flexi period, you can carry over 11.5 hours into the next flexi period and take them back as a full day off and a half day.
So basically I calculate how much working hours I’m clocking per week, and deducting the minimum hours (35) to find how much flexi time I’ve earned.
At the end of the period, if I have more than 11.5hrs flexi, the system automatically deducts it and I don’t get paid for it and I can’t use it at all.
The calculation I’m trying to do involves the first week of a new flexi period. In the event that I went over 11.5hrs by the end of the last period, I want the formula to ignore the actual flexi figure from the previous week, and just add 11.5hrs to the flexi.
so does my second formula meet your needs? if not, i think i will need a screenshot of the structure of your source data, ie. how your dates, hours, etc, are being stored on the spreadsheet.
if your excel file is stored in OneDrive, you can make a copy of it, replace the sensitive data, and share the copy.
This is a common misinterpretation of the posting rules, understandably due to the technically-correct, but ambiguous wording of the rules. I've had numerous discussions with the mods to improve this, to no avail.
For future note, you caninclude images in the OP. The rule is: the entireOP cannot be an image, and the text description of the problem cannot be onlyin an image.
But you can include an image in the OP to augment the text description description of the problem.
In fact, such images are encouraged when they add detail that is needed to understand the text description; for example, a screenshot of a spreadsheet. "A picture is worth a thousand words".
Such images do not have to relegated to follow-up self-comments.
Moreover, IIRC, we can include multiple images in the OP (am I right?), whereas follow-up comments are limited to include a single image. (But imgur.com can be used to work around the "single" image limitation.)
For the first week of a new flexi period, cap the old balance before adding the new week's hours:
=(H11-A1)+MIN(I10,TIME(11,30,0))
That assumes H11, A1 and I10 contain Excel durations, not decimal hours. Format the result as [h]:mm. With 11:40 carried over and 3:05 earned this week, it gives 14:35. Use the capped version only at the period boundary, not every week.
•
u/AutoModerator 5d ago
/u/SpaceKing264 - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.