Round result of formula using specific values

I am trying to create a log book for flight times. I am getting the date and time (24 hour time) and then the result is a duration. I am looking for help for the following:


When the land time goes into the next day.


G3 is Take off Time H3 is Land time and I3 is the duration and J3 is total hours.


Aug 10 2023 19:02 Aug 11 2023 02:00 = 6h 58M


I am trying to round I3 to the nearest tenth based on minutes L3 and tenths M3:

Minutes Tenths

0 - 2 0.0

3 - 8 0.1

9 - 14 0.2

15 - 20 0.3

21 - 26 0.4

27 - 33 0.5

34 - 39 0.6

40 - 45 0.7

46 - 51 0.8

52 - 57 0.9

58 - 60 1.0


Since this is flying, how could time zones be included should the time zone be used for the location where the flight originated?

Any helps is appreciated.


Thank you

Jamie


iMac 21.5″

Posted on Aug 20, 2023 12:03 PM

Reply
4 replies

Aug 26, 2023 1:57 PM in response to magootrp4

couple of points on numbers before we get to the solution I came up with...

  1. In numbers we dont normally put different dat tables on one numbers "grid"/table of columns and rows. meaning break your tenths lookup to its own table
  2. Time actually does have a date component, you just have to make sure that your Landing time includes the roper date and it will subtract properly (look at cell C3 in the screen shot below, its the same data as C2 just formatted to show the date portion)


The solution I came up with. I tried to find a clean method of using just basic math to get to the tenths, but noticed how your tenths table includes 58 as the 1.0. so that wasn't going to work.


I added what I call "Helper columns" to walk through what I did...

D2 is just the conversion to decimal duration in hours. you can skip this one if you want

E2 breaks out the minutes from the total flight duration

F2 Does a XLookup against your decimal tenths table (notice its on a new table called tenths), lookup up the minutes on column A and the result comes back from B of the tenths table

G2 combines The INT of the Duration and adds the decimal value back to it. You could replace the D2 in this formula with DUR2HOURS(C2-B2) and not have to have D at all


Aug 27, 2023 8:38 AM in response to magootrp4

To address the team zone issue create this separate table, taken directly from https://www.world-timezone.com/timezones-in-north-america/. If you're not in North America or need more time zones, fill as you wish. The first 4 columns were directly copy-pasted (adapting style) from the web site, the last column was filled manually.



Copy the content of the first column of the time zone table (minus the header), and create a temporary table where you'll paste it. Select all pasted values then head to the Format / Cell pane and choose Pop-up menu as the format. This will fill up all the values at once. Below the list select Empty by default.




Then in you flight compilation table you need to add two columns to allow the selection of the time zone, H and J in my example. Copy the first cell of the temporary table and paste it in all cells of the two time zone columns. At this point you have the means of selecting the time zone for take off and landing.




The reworked formulas are therefore, on line 2 then copied down.

In the DURATION column:

=IF(ISBLANK(G2),"",(I2+XLOOKUP(J2,Abbreviation,TimeZone value,0))−(G2+XLOOKUP(H2,Abbreviation,TimeZone value,0)))


In the Total Hours column:

=IFERROR(IF(K2="","",K2+L1),DURATION(,,0))


In the DURATION (decimal) column:

=IF(ISBLANK(G2),"",ROUND(DUR2MINUTES((I2+XLOOKUP(J2,Abbreviation,TimeZone value,0))−(G2+XLOOKUP(H2,Abbreviation,TimeZone value,0)))÷60,1))


In the Total Hours (decimal) column:

=IFERROR(IF(M2="","",M2+N1),0)


The lookup table for the tenths of hours is not required as ROUND takes care of that.


I included the duration calculations and totals both in hours:minutes and hours.decimal formats, use only the ones that satisfy you and dismiss the others. Make sure the references match the columns with the same header than in my example though.


Note that when you enter a take-off or landing time, if you enter a time without date it uses by default the current date (even if you don't see it). I chose to format the take-off and landing times with dates to make it obvious, but you don't have to. It means that if you take off on Saturday and land on Sunday but enter both times upon landing, you'll have to manually adjust the date of the take off to calculate correctly.


Aug 27, 2023 7:04 PM in response to Recycleur

Wow that time zone thing was complicated and a few misplaced parentheses and +/- signs caused havoc. I was also worried that crossing the international date line would cause problems but it looks OK with the updated formulas.


Finally, the durations will be correctly calculated with the following. My apologies for the previous errors.


In the DURATION column, row 2:

=IF(ISBLANK(G2),"",(I2−XLOOKUP(J2,Abbreviation,TimeZone value,0))−(G2−XLOOKUP(H2,Abbreviation,TimeZone value,0)))


In the DURATION (decimal) column, row 2:

=IF(ISBLANK(G2),"",ROUND(DUR2MINUTES((I2+XLOOKUP(J2,Abbreviation,TimeZone value,0))−(G2+XLOOKUP(H2,Abbreviation,TimeZone value,0)))÷60,1))


Validation:

Round result of formula using specific values

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.