Stephan
Member
Hello
SIMPLER "1 CELL" EXPRESSION then this? It is CALC of: FINISH DATE/TIME - START = DECIMAL HOURS
This is…. an NESTED If FORMULA with DATE / TIME / INT & MOD, I’ve amalgamated (Joined..) together from separate Formulas to workaround the 24H HOUR MAX limitations of XL Dates/Times as conventional TIME (HH:MM) is Ltd to same day in same 24hr. To Further explain this in 3 Parts, Formula in plain English 1st of all:
SAME DAY: SUBTRACT (TIME CELLS no DATE)
If DIFFERENT DAY >24+: INT (DATE CELLS with TIME)
If DIFFERENT DAY <24-: MOD (DATE CELLS with TIME)
And in more detail, with Formula Passage ref’d of 1 row as E.G., to indicate its purpose.
1. DATE CALC: SAME DAY or DIFFERENT DAY?
=IF(DATE(YEAR(C25),MONTH(C25),DAY(C25))=DATE(YEAR(F25),MONTH(F25),DAY(F25))
2. DATE CALC: SAME DAY
(F25-C25)*24
3. DATE CALC: IF DIFFERENT DAY, LESS or GREATER then 24HRS?
IF(F25-C25>=TIME(23,59,59)
4. DATE CALC: DIFFERENT DAY >24HR
INT((F25-C25)*24)
5. DATE CALC: DIFFERENT DAY <24HR
MOD(F25-C25,1)*24)
Please see, also attached sheet:

COLUMN: M
ROWS: 25 - 30
Purpose is to calculate the cost of GAS PER HOUR AVERAGE.
It is derived from used GAS M3 > GAS KWH hence GAS CONSUMED PER USAGE with DATE/TIME START/FINISH, which is converted into DECIMAL NUMBER with the TITLE TOP FORMULA for ease of calculation of:
GAS KWH USED = £ PER HOUR AVERAGE (ie: G = £)
COLUMN: K
ROWS: 25 - 30
Anyways.. This all works by the way, with.. current Data Set, obviously if not recorded at exact HOUR to HOUR in WHOLE NUMBER then requires.. this complicated Formula, due to.. DECIMAL PLACES… which is where MOD (<24HR pre-fer in 1 HOUR BLOCKS) Formula is required! The INT (>24HR+) Formula is needed for accurate calculation exceeding the 24 Hour threshold of Excel Time…
I’m not desperate for other remedys or long winded remedial processes, as it does work, all hard work done, just choose correct DATEs to COPY & PASTE, enter READINGS etc. And yes it is already is realistically a 1 CELL FORMULA wrap, I know that, took some thought as not expressions I ever used regular with EXCEL spreadsheets, having said that is there a better way,, I don’t know, Suits me so far… So constructive advise I welcome…!
But any thoughts to why Excel has made DATES with TIMES such an over complication, EG: Why not just let DATE with TIME be accurate! DD MM YY HH MM SS
Cheers Stephan
CROSSTHREADS: keen on these forums, here is few bolts to that link n others...
https://www.excelforum.com/excel-fo...od-simpler-1-cell-expression.html#post6042244
www.myonlinetraininghub.com
SIMPLER "1 CELL" EXPRESSION then this? It is CALC of: FINISH DATE/TIME - START = DECIMAL HOURS
=IF(DATE(YEAR(C25),MONTH(C25),DAY(C25))=DATE(YEAR(F25),MONTH(F25),DAY(F25)),(F25-C25)*24,IF(F25-C25>=TIME(23,59,59),INT((F25-C25)*24),MOD(F25-C25,1)*24))
This is…. an NESTED If FORMULA with DATE / TIME / INT & MOD, I’ve amalgamated (Joined..) together from separate Formulas to workaround the 24H HOUR MAX limitations of XL Dates/Times as conventional TIME (HH:MM) is Ltd to same day in same 24hr. To Further explain this in 3 Parts, Formula in plain English 1st of all:
SAME DAY: SUBTRACT (TIME CELLS no DATE)
If DIFFERENT DAY >24+: INT (DATE CELLS with TIME)
If DIFFERENT DAY <24-: MOD (DATE CELLS with TIME)
And in more detail, with Formula Passage ref’d of 1 row as E.G., to indicate its purpose.
1. DATE CALC: SAME DAY or DIFFERENT DAY?
=IF(DATE(YEAR(C25),MONTH(C25),DAY(C25))=DATE(YEAR(F25),MONTH(F25),DAY(F25))
2. DATE CALC: SAME DAY
(F25-C25)*24
3. DATE CALC: IF DIFFERENT DAY, LESS or GREATER then 24HRS?
IF(F25-C25>=TIME(23,59,59)
4. DATE CALC: DIFFERENT DAY >24HR
INT((F25-C25)*24)
5. DATE CALC: DIFFERENT DAY <24HR
MOD(F25-C25,1)*24)
Please see, also attached sheet:

COLUMN: M
ROWS: 25 - 30
Purpose is to calculate the cost of GAS PER HOUR AVERAGE.
It is derived from used GAS M3 > GAS KWH hence GAS CONSUMED PER USAGE with DATE/TIME START/FINISH, which is converted into DECIMAL NUMBER with the TITLE TOP FORMULA for ease of calculation of:
GAS KWH USED = £ PER HOUR AVERAGE (ie: G = £)
COLUMN: K
ROWS: 25 - 30
Anyways.. This all works by the way, with.. current Data Set, obviously if not recorded at exact HOUR to HOUR in WHOLE NUMBER then requires.. this complicated Formula, due to.. DECIMAL PLACES… which is where MOD (<24HR pre-fer in 1 HOUR BLOCKS) Formula is required! The INT (>24HR+) Formula is needed for accurate calculation exceeding the 24 Hour threshold of Excel Time…
I’m not desperate for other remedys or long winded remedial processes, as it does work, all hard work done, just choose correct DATEs to COPY & PASTE, enter READINGS etc. And yes it is already is realistically a 1 CELL FORMULA wrap, I know that, took some thought as not expressions I ever used regular with EXCEL spreadsheets, having said that is there a better way,, I don’t know, Suits me so far… So constructive advise I welcome…!
But any thoughts to why Excel has made DATES with TIMES such an over complication, EG: Why not just let DATE with TIME be accurate! DD MM YY HH MM SS
Cheers Stephan
CROSSTHREADS: keen on these forums, here is few bolts to that link n others...
https://www.excelforum.com/excel-fo...od-simpler-1-cell-expression.html#post6042244

DATE / TIME / INT / MOD / NESTED IF FORMULA: SIMPLER “1 CELL...
Hello SIMPLER EXPRESSION “1 CELL” then this? It is CALC of: FINISH DATE/TIME - START = DECIMAL HOURS =IF(DATE(YEAR(C25),MONTH(C25),DAY(C25))=DA...

Attachments
Last edited: