=SUM(SUBSTITUTE(TEXT(C3:H3,"0.00"),".",&

vane0326

Well-known Member
Joined
Aug 29, 2004
Messages
819
I've been trying to figuer this formula all week and I just dont know how he got it to work. Is there anyone that can give me a explanation how to get this formula by using the fx function in excel and step by step of what array in formula does: =SUM(SUBSTITUTE(TEXT(C3:H3,"0.00"),".",":")*{-1,1,-1,1,-1,1})*24
Employee Time Sheet.xls
BCDEFGHI
2Start TimeLunch StartLunch EndBreak StartBreak EndEnd TimeTotal
3Employee5.308.329.0210.0010.2014.007.67
Sheet1
 
You must use the TEXT function so the numbers will all show up with the same amount of fixed decimal places, else failurre of time conversion will follow. the ,".",":") part says replace all "." with ":". So that is where the time conversion comes into play.

And as previously stated, you cannot get the results you are looking for from the Sum wizard. You need to use F9 in the formula bar or use the formula auditor in 2002 or above. One other possibility would be Aaron Blood's Explode: http://www.xl-logic.com/pages/explode.html.
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Dutchy said:
If there's any way you can have your times shown as true times, e.g. 05:30, 09:02 etc. then you wouldn't need such an elaborate formula, you'd just need

=(H3-C3-E3+D3-G3+F3)*24 formatted as number

to give you the total hours worked

True. However, it's not unitelligible. All that is required a working knowledge of array/vector multiplication and summing. Thus, rewriting your suggestion (absolutely no need to do so though), one gets:

=SUMPRODUCT(C3:H3,{-1,1,-1,1,-1,1})

by

-C3, D3, -E3, F3, -G3, H3

for

=SUM(-C3, D3, -E3, F3, -G3, H3) is equal to =(H3-C3-E3+D3-G3+F3)
 
Upvote 0
That formula goes work and you'll get your answer 7.80 but to convert it to time value it wont work. meaning you wont get 7.67 using this formula!
=SUMPRODUCT(C3:H3,{-1,1,-1,1,-1,1})

But how ever the formula you posted earlier does work and you will get the 7.67

=SUMPRODUCT(--SUBSTITUTE(TEXT(C3:H3,"0.00"),".",":"),{-1,1,-1,1,-1,1})*24

Thanks for the rewrite!
 
Upvote 0
Aladin,

I only suggested =(H3-C3-E3+D3-G3+F3)*24

because back in Vane's original thread he'd asked why

=(H3-C3-E3+D3-G3+F3) was giving the wrong answer, namely 7.80.

The answer was, of course, that the values were numbers not times so rather than opting for a wholly different approach I wondered whether he could simply have converted the decimals to times and adjusted the formula very slightly.

I agree that the array formulas you suggest are not as challenging as they might first appear, I'm even starting to get the hang of them myself!
 
Upvote 0
vane0326 said:
That formula goes work and you'll get your answer 7.80 but to convert it to time value it wont work. meaning you wont get 7.67 using this formula!
=SUMPRODUCT(C3:H3,{-1,1,-1,1,-1,1})

You missed the point...

This formula will work if C3:H3 houses true time values. But then such a formula is not needed. That's what Dutchy was pointing out. I picked that up to explain how/why the Sum formula you were given.

Thus, in your case, the conversion of the values in C3:H3 to true time values are required. Hence:

{=SUM(--SUBSTITUTE(TEXT(C3:H3,"0.00"),".",":"),{-1,1,-1,1,-1,1})*24}

or faster

=SUMPRODUCT(--SUBSTITUTE(TEXT(C3:H3,"0.00"),".",":"),{-1,1,-1,1,-1,1})*24

which just needs enter.
 
Upvote 0

Forum statistics

Threads
1,215,391
Messages
6,124,673
Members
449,179
Latest member
fcarfagna

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