Help with issues calculating using dates

eraust

New Member
Joined
Sep 13, 2022
Messages
17
Office Version
  1. 365
Platform
  1. Windows
Hi All

I'm attempting to make a schedule which autopopulates/calculates based on a start/finish time.

I've asked for help previously with different versions of this schedule but this particular version, I'm having an issue with the activities that lasts 10 hours.

Basically, if the start time is 04:00, 07:00, 10:00 or 13:00 - it's populating 11 hours rather than 10. This isn't happening with the activities that last 6 or 8 hours or any other start times other than those listed. I've tried checking the format of all the elements that are involved in my formula and everything seems to be the same (custom, hh:mm) so I can't figure out what's going wrong.

I'm sure there are different ways of making this work but I'd rather keep the formulas I'm using the same if possible.

Thanks in advance all

Cell Formulas
RangeFormula
A4:A8A4=TEXT($B$4,"ddd")
B4:B8B4=$A$2
E4:E8E4=IF(D4<>"",_xlfn.XLOOKUP(C4,Sheet2!$A$2:$A$6,Sheet2!$B$2:$B$6)+D4,"")
AE4:AK8,F4:AC8F4=IF($D4="","",(IF(AND(F$1>=$D4,F$1<$E4),$C4,"")))
Cells with Data Validation
CellAllowCriteria
D4:D8List=Sheet2!$A$10:$A$33
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Upvote 0
Solution
The only one that is appearing correctly is Activity 1: Start/finish time says 06:00 - 16:00. The result starts populating at 06:00, for 10 hours finishing at 16:00.

The rest are all appearing wrongly:

Activity 2 - Start time says 07:00 but the result starts at 08:00, for 10 hours finishing at 18:00
Activity 3 - Start/finish time says 08:00 - 14:00 but the result starts at 08:00, for 8 hours finishing at 15:00
Activity 4 - Start/finish time says 09:00 - 17:00 but the result starts at 09:00, for 9 hours finishing at 18:00
Activity 5 - Start/finish time says 10:00 - 18:00 but the result starts at 11:00, for 7 hours finishing at 18:00
New 1 - Start/finish time says 10:00 - 16:00 but the result starts at 11, for 5 hours finishing at 16:00
New 2 - Start/finish time says 10:00 - 18:00 but the result starts at 11, for 7 hours finishing at 18:00
 
Upvote 0
... it works on the activities that last 10 hours. However, my activities that last 6 and 8 are now out of sync with the issue that I was having with the 10 hour ones.

6 hour durations are now displaying as 7 hours and 8 as 9.
See if the following formula works for you:
Excel Formula:
=IF($D4="","",(IF(AND(MROUND(F$1,"0:01")>=MROUND($D4,"0:01"),MROUND(F$1,"0:01")<MROUND($E4,"0:01")),$C4,"")))
 
Upvote 0
Upvote 0
This has worked perfectly, thank you so much.

I'm not sure I understand why it's working? Any chance you could explain?
 
Upvote 0
Excel represents Hours as a decimal number ranging from 0.0 (0h0m0s) to 1 (24h00m00s)
Cell Formulas
RangeFormula
F18:F41F18=E18
E19:E41E19=D19/24


Wherever the decimal value is represented by 15 significant figures (the maximum significant figures that excel uses) there is the risk that a "calculated hour" differs from the same typed hour by a "flick". Truncating decimal to one of the terms of a comparison helps avoiding that "a flick" make the comparison failing
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

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