calculate cost from hours worked - excel

I have two columns in my spreadsheet.
A B
Total Hours Worked Total Cost
A is formatted as a duration/time, i.e. 01:34:20 and is the total elapsed time it's taken to complete a task
B should be a formula of some sort that calculates the cost. Right now I have the function A2*25 but this results in B2 being too little.
What do I need to do to correct the formula so the total cost is correct?

You can use this as B2 -
=(HOUR(A2) + MINUTE(A2) / 60 + SECOND(A2) / 3600)*25

Excel stores durations as fractions of days.
You just need to multiply the duration by 24 to have the number of hours worked and you get the correct result.
=A2*25*24

Related

Excel TIME duration over 24 hours

Data is:
A1 = 29. B1 = 30. C1 = 2.
D1 = TIME(A1, B1, C1).
How can I get D1 to return 29:30:02?
Formatting the D1 cell to [hh]:mm:ss does NOT work!
If I ran for 29 hours in a month, Excel thinks I ran for only 5 hours.
Thank you.
Edit: Thank you!! I got it!!! D1 = TIME(A1, B1, C1) + INT(A1 / 24)
The result you get is exactly how TIME function works:
Hour Required. A number from 0 (zero) to 32767 representing the
hour. Any value greater than 23 will be divided by 24 and the
remainder will be treated as the hour value. For example, TIME(27,0,0)
= TIME(3,0,0) = .125 or 3:00 AM.
You could do
=A1/24+B1/24/60+C1/24/60/60 in D1
Then the resulting value formatted as [hh]:mm:ss will show 29:30:02.
That is because 1 is 1 day in Excel. So 1/24 is 1 hour, 1/24/60 is 1 minute and 1/24/60/60 is 1 second.
Time is trying to give you clock time so 29hrs=5am.
So if you want that result how about just:
D1=CONCATENATE(A1,":",B1,":",C1)
If then you want the 02 you would have to interject a little formatting to those columns...
Very similar solution as given above by Axel Richter is shown in support article Add or subtract time by Microsoft.
Basically it boils down to using custom format of [h]:mm;#. However I am not sure, what the exact difference to [hh]:mm:ss (or more precisely to [hh]:mm) is - if at all? A quick check in Excel did not reveal any differences to me.
However, as the support article covers topic of adding and subtracting of time values pretty comprehensively, I hope it will be useful to be cited here.

Powerpivot Dax- Calculate number of Hours after a fixed time

I have a list of times in a column [Logtime]:
11:45:44PM
07:05:05PM
I'd like to create a measure that returns the total number of hours after 6:30PM. So given the above times:
5.5
0.58
HoursAfter:=[logtime] -6:30PM doesn't work.
Hour[logtime] - hour(18.5) also doesn't work
EDIT:
timevalue([logtime]) - timevalue("05:00:00") works but it returns a datetime ala
12/30/1899 5:17:16PM
I need to convert the time 5:17:16 into decimal hours i.e. 5.26, how can I do this?
There may be a slightly more elegant way, but I was able to create a calculated column that does what you want as follows,
HoursAfter = DATEDIFF(TIMEVALUE("6:30 PM"), Times[LogTime], SECOND) / 3600
This takes the time difference between 6:30 PM and your LogTime in units of seconds and then converts it to hours by dividing by 60*60 = 3600.
Edit: A simpler formula can be written as follows,
HoursAfter = 24 * (Times[LogTime] - TIMEVALUE("6:30 PM"))
(Multiply by 24 since the datetime values are stored in units of days.)
timevalue([logtime]) - timevalue("05:00:00")

Find a temperature and work out how long it remained >= this temperature

I have an excel sheet with times in one column and temperatures in another. I'm trying to work out a formula that will find a certain temperature and measure how long it remained at that temperature.
11:25:29 AM 69.3°C
11:26:29 AM 69.6°C
11:27:29 AM 69.8°C
11:28:29 AM 70.0°C
11:29:29 AM 70.2°C
11:35:29 AM 70.8°C
11:36:29 AM 70.3°C
11:37:29 AM 69.5°C
11:38:29 AM 68.5°C
11:39:29 AM 67.5°C
12:39:29 PM 66.3°C
1:39:29 PM 52.1°C
2:39:29 PM 12.1°C
3:39:29 PM 5.0°C
In this example, I would like to find when it hit 70.0°C and how long it stayed above 70.0°C.
This is a bit of a tough problem because you might have multiple occasions where you go above 70 degrees. In that case, do you want the total time spent above 70 in the entire dataset, or do you want the total time spent above 70 consecutively? And then, how are you determining which of these potential multiple nonconsecutive periods you are talking about?
That said, you can try this. If column A is your datetime, and column B is your temp reading, specify another cell as your temperature reference value ($D$1 here), and in column C starting in row 2 do this:
=(A2-A1)*IF(B2>=$D$1,1,0)
and then copy that all the way down. What that does is it calculates the time difference between measurements and then if the temperature at that time is greater than your reference, it multiplies it by 1, otherwise it multiplies by 0. Because a date/time in Excel is really just a number, what you get is an interval of a day between measurements in each cell of column C. In other words, .25 = 6 hours.
Now that you have that data in column C, you are free to further parse it. You can use a simple SUM(C:C) formula in a cell, or you can go back and sum up individual ranges. I hope this helps.

Excel formula for an average where the price increases every day

Can some one help me with a simple forumla in excel for the following problem.
I need to be able to predict an average price for the month. For example, if the current price is $1000 and there are 5 days left until the end of the month, I believe the price will increase £50 p/day. 1050 then 1100 1150 etc So the average price for the last six days will be 1100?
i would like to be able to do a forumla that works it out from the current price, the increase amount and the days left with out having to have a cell for each day etc?
Is this possible? i have tried google but have come up with nothing, a difficult question to articulate.
Sounds like you're having troubles finding the days in the month and the percentage of the month that has already passed / left
To calculate the number of days in the current month use this formula
=EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1)
To calculate the current day of the month use this formula
=DAY(NOW())
To calculate the percentage of the month already gone
=DAY(NOW()) / (EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1))
To calculate the percentage of the month remaining
=1 - (DAY(NOW()) / (EOMONTH(NOW(), 0)-EOMONTH(NOW(), -1)))
I'm not clear what you are averaging - is it 5 days or 6?
If you start with 1000 and average 5 days then you are averaging 1000, 1050, 1100, 1150 and 1200 so the average is 1100 - if that's the required result try this formula
=A2+B2*(C2-1)/2
where A2 is price, B2 increase amount and C2 days left
If you are averaging 6 days then that starts at 1000 and ends at 1250 so average is 1125 and the formula should be:
=A2+B2*C2/2

Excel timespan calculation for time report

I need to write a time report for my company.
Sadly I have to use a given format:
B1: 9.00 - 18.00 //timespan between arrival and leaving
C1: 60.00 //minutes I spent in drinking coffee
D1: 8.00 // total hours of work
I need a formula that a) calculates the total hours between the both times in A1, subtracts the minutes of having a break in minutes, and gives me the total hours worked in D1. I am not allowed to change the format of the cells (like writing arrival and departure times seperatly in columns) which makes it complicated.
Thank you in advance, Harry
UPDATE
=IF(ISBLANK(B16)," ",(TIMEVALUE(TRIM(RIGHT(B16, SEARCH("-",B16,1)-1)))-TIMEVALUE(TRIM(LEFT(B16, SEARCH("-",B16,1))))) * 24 -C16/60)
Works fine now.
You can try that for the result in D1:
=TRIM(RIGHT(B1, SEARCH(" - ",B1,1)))-TRIM(LEFT(B1,SEARCH(" - ",B1,1)-1))-C1/60
or if you don't have any spaces between the hyphen (-) I suggest:
TRIM(RIGHT(B1, SEARCH("-",B1,1)-1))-TRIM(LEFT(B1,SEARCH("-",B1,1)-1))-C1/60
Explanation:
=TRIM(RIGHT(B1, SEARCH(" - ",B1,1)-1)) = right part of the timespan (18.00)
=TRIM(LEFT(B1,SEARCH(" - ",B1,1)-1)) = left part of the timespan (9.00)
C1/60 = minute of having a break (1 hour = 60 minutes)

Resources