'Match' function not working as planned matching time

juanbolas

New Member
Joined
Dec 3, 2014
Messages
40
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I'm trying to get the following sheet to work but got stumped. The bottom block trees to match its time column to the times set in the block above. But, for some reason, for times greater than or equal to 13:00 (military time) it shows #N/A. It looks like it has something to do with the processing of military times but I'm not sure how to get around it.

Thanks in advance for your help.

Juan

Tasklist v2 for question v0.1.xlsm
ABCDEFGHI
1
2
3Day starts9:00
4
5TasksLengthStartEnd
6Top 31Thnk & plan00:3009:0009:30
72Task 201:0009:3010:30
83Task 300:3010:3011:00
9Top 54Task 400:3011:0011:30
105Task 502:0011:3013:30
11Unplanned6Task 600:3013:3014:00Things seem to start to go wrong when the hour is => 13:00
127Task 700:3014:0014:30
138Task 800:3014:3015:00
149Task 901:3015:0016:30
1510Task 1000:3016:3017:00
16Match
17SlotTimeTaskInterruptionsLengthTask #only
1819:00Thnk & plan11
1929:30Task 222
20310:00Task 22#N/AThis #N/A is correct
21410:30Task 333
22511:00Task 444
23611:30Task 555
24712:00Task 55#N/AThis #N/A is correct
25812:30Task 55#N/AThis #N/A is correct
26913:00Task 55#N/AThis #N/A is correct
271013:30Task 666
281114:00Task 66#N/AThis should match to task 7 (line 7 above)
291214:30Task 66#N/AThis should match to task 8 (line 8 above)
301315:00Task 66#N/AThis should match to task 9 (line 8 above)
311415:30Task 66#N/A
321516:00Task 66#N/A
331616:30Task 66#N/AThis should match to task 10 (line 8 above)
341717:00Task 66#N/A
351817:30Task 66#N/A
361918:00Task 66#N/A
37
Dayplan
Cell Formulas
RangeFormula
C6:C15C6=ROW()-ROW($C$6)+1
F6F6=F3
G6:G15G6=F6+E6
F7:F15F7=IF(C7=1,F$3,F6+E6)
D7:D15D7="Task "&TEXT(C7,"0")
B18:B36B18=ROW()-ROW($B$18)+1
C18:C36C18=DayStartTime+(B18-1)*"0:30"
D18:D36D18=OFFSET($D$5,$G18,0)
G18:G36G18=IF(ISNA(MATCH(C18,F$5:F$16,FALSE)),G17,MATCH(C18,F$5:F$16,FALSE)-1)
H18:H36H18=MATCH(C18,F$5:F$16,FALSE)-1
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Juanbolas,

Your challenge is due to the way Excel handles precision. While two numbers may look the same on the screen there may be differences in actual storing of that number.

Excel stores dates as an integer and time as a fraction. One second is stored as a value of 0.0000115740740740741 so you can use the MROUND function to do your calculations to the nearest second.

In F6 and copied down to F15 use:
Excel Formula:
=IF(C6=1,MROUND(F$3,0.0000115740740740741),MROUND(F5+E5,0.0000115740740740741))

In C18 and copied down to C36 use:
Excel Formula:
=MROUND(DayStartTime+(B18-1)*"0:30",0.0000115740740740741)
 
Upvote 0
Solution
Thanks! Works great! I tried doing a normal 'round' before but it didn't work. I'll have to investigate the differences between 'round' and 'mround'.

Again, thanks toadstool!

Hi Juanbolas,

Your challenge is due to the way Excel handles precision. While two numbers may look the same on the screen there may be differences in actual storing of that number.

Excel stores dates as an integer and time as a fraction. One second is stored as a value of 0.0000115740740740741 so you can use the MROUND function to do your calculations to the nearest second.

In F6 and copied down to F15 use:
Excel Formula:
=IF(C6=1,MROUND(F$3,0.0000115740740740741),MROUND(F5+E5,0.0000115740740740741))

In C18 and copied down to C36 use:
Excel Formula:
=MROUND(DayStartTime+(B18-1)*"0:30",0.0000115740740740741)
 
Upvote 0

Forum statistics

Threads
1,214,896
Messages
6,122,132
Members
449,066
Latest member
Andyg666

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