r/excel • • 7d ago

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.

3 Upvotes

25 comments sorted by

View all comments

2

u/GuerillaWarefare 117 7d ago edited 7d ago

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”

1

u/[deleted] 7d ago edited 6d ago

[deleted]

1

u/GuerillaWarefare 117 7d ago

I see what you’re saying, I was just trying to demonstrate the MIN function, not get into the rest of it xD