Calculate 30 hrs (24hrs+) time as single day in excel - excel

I have a restaurant log in following format.
Date | Time | Bill Number | Item | Price | Total Orders
The store time is 11 Am to next day 5 am.
which will be over 24 hours.
But I want to calculate 11 am to next day 6 am as a single day.
Currently I am using Filter and sort to do it, but since data is of 2-3 months, is there a formula to sort it out?
For example
Jan 1st 11 am to Jan 2nd 6 am -> I want to calculate these time period as one day.

Solved it
using this
=TRUNC(B2+C2-TIME(6,0,0))

Related

Find a customer usage for a given period of time

I have to bill a customer based on monthly usage however I'm only provided with a date range and total usage. I need to calculate the average daily usage, then calculate the number of days in each for the bill period, then multiply the days in month by the average to get the number of 'x' to bill the customer.
For example. I have two customers below and each has a different bill period and usage.
I'm given the data in Excel below. I'm struggling to build a formula that will give me A) the number of days in each month, B) the average use per day, C) the total amount used in each month. See the example below with how I calculate by hand.
Cell A1 Cell A2 Cell A3
9/5/2017 10/4/2017 83
Example:
Billing Period
Cust #1: 9/4/2017-10/4/2017 and usage is 85
Cust #2: 9/11/2017-10/11/2017 and usage is 1065
Cust #1
Sept Days is 27
Oct Days is 4
total days is 31
Ave use per day 2.7 (85 divided by 31)
Answer:
**Sept Usage is 74 Oct Usage is 11**
Cust #1
Sept Days is 20
Oct Days is 11
total days is 31
Ave use per day 34.35 (1065 divided by 31)
Answer:
**Sept Usage is 687 Oct Usage is 378**

Powerpivot DAX time- counting when a timestamp falls within 1st 30 mins or 2nd 30 mins of an hour

say I have a list of users and timestamps.
User Time
Tim 6:15PM
Tim 6:17PM
Tim 6:44PM
Tim 3:33PM
Bort 8:00PM
Bort 9:04PM
Bort 9:05PM
I want to count, for each user, the number of 30 minute increment they have a timestamp for, within each hour between 5PM and 8 30AM
Result:
Tim 2
Bort 2
Note that Tim has times at 6:15 and 6:17, this falls within the first 30 minutes of the 6PM hour, therefore it only counts as 1. He has a time at 6:44PM, which comes after 6:30PM, therefore it also counts as 1. Altogether he has 2
Bort has a time in the first half of 8PM but not in the latter half. So he gets 1. He then has two times within 9PM. Altogether he has 2.
Is this too intense to do in Powerpivot/dax?
I'm assuming you meant PM for those last two Bort rows since that's how you referred to it later.
I was able to achieve this by doing the following:
Create a calculated column HalfHour = ROUNDUP(48*TimeStamps[Time],0).
Create a measure CountTimeStamps as below.
Put them in a matrix visual with User on the rows and CountTimeStamps in the values.
CountTimeStamps =
CALCULATE(
DISTINCTCOUNT(TimeStamps[HalfHour]),
TimeStamps[Time] <= TIMEVALUE("8:30AM") ||
TimeStamps[Time] >= TIMEVALUE("5PM")
)

Add business days in start date then subtract 1 business day (Excel)

My count of business days in end date should be, for example, May 30 to May 31 will be 2 days and May 30 to May 30 is already counted as 1 day. My problem with WORKDAY is that it counts the day from May 30 to May 31 as 1 day only.
What I've think of is to subtract the result of WORKDAY with 1 business day to get my desired result. However, with my current formula, I was only able to subtract the result of WORKDAY without concerning the weekends (=WORKDAY(C2,B2-1)).
So for example, column C is June 3 (Friday) and column B is 2. The output of my formula will be June 5 (Sunday) because of the subtraction, I want it to be June 6. How will I do that?
Column B = Duration
Column C = Start Date
Column D = End Date (Formula-based)
Column D:
=WORKDAY(C2,B2-1)
Provide Input
B | C | D
2 | 2016/06/03 |
Desired outcome
B | C | D
2 | 2016/06/03 | 2016/06/06
TRY
=WORKDAY.INTL(C2,B2-1,1)
This will set sat. and sun. as offdays
It is not clear exactly what you want to do.
If you want to do an inclusive count of Workdays from 2016/06/03 to 2016/06/06 then you could just use the NETWORKDAYS function.
If you want to add two workdays to Jun 3, and have Jun 3 count as the first day, to give you the result of Jun 6, then use
=WORKDAY(C2-1,B2)
That takes care of the issue where C2 is not a workday, and you want to count 1 workday as the first workday after C2
Otherwise, your formula should work as written.

Excel find date difference between minimum and maximum date in month

I'm trying to fix up a formula I have that's having some issues. It's supposed to track # days invoiced in a month, so the high-level idea is to take the maximum date in a month and subtract the minimum date in the month, and on error subtract the 1st day of the month. My current formula has issues adjust for invoices that may cross months, an example being 1/25 - 2/3 where if this were the only invoice, January should show 7 days invoiced and February would show 3. If there were another invoice from 2/15 - 2/28, I would want Feb to show the maxed invoice days, 14 in this example.
For reference here's what a table could look like:
A B C D E F
start month end month invoice begin invoice end Month Max Days invoiced
jan 1 feb 1 1/25/14 2/3/14 1/1 7
feb 1 feb 1 2/15/14 2/28/14 2/1 14
3/1
etc.........
I tried the formula below but it was erroring out, plus I don't think it will account for gaps in invoices like in my example.:
=IF(B2:B100=X1,MAX(D2:D100),) - IF(A2:A100=X2,MIN(C2:C100),A2)
'where column X is a list of months, X1 = 1/1, X2 = 2/1, etc.
No luck with this formula either, keeps erroring out and giving 0 values:
{=DATEDIF(IF(A2:A100=E2,MIN(C2:C100),),IF(B2:B100=E2,MAX(D2:D100),),"d")}
I appreciate your help!
Not sure exactly what you are looking for but you could probably make use of the EOMONTH() function. Here's an example of it:
=EOMONTH(A2,0)-A2+1
by the way - here is how you would get the start of the month:
=EOMONTH(TODAY(),-1)+1
Try the following per your comment below:
"I think this could be useful but I'm not sure it would work if the invoice end was, say, 2/21 or anytime before the EOM"
=IF(B3>=EOMONTH(A3,0),EOMONTH(A3,0)-A3+1,B3-A3+1)

excel - calculate date based on number of hours / planner

I'm trying to figure out how to auto generate/populate a column in excel based on the number of hours filled in another column:
Start date: 04-08-2011
Hours in one day: 8
Issues Hours Date
part 1 | 2 | 04-08-2011
part 2 | 6 | 04-08-2011
part 3 | 2 | 05-08-2011
part 4 | 2 | 05-08-2011
part 5 | 8 | 06-08-2011
part 6 | 2 | 06-08-2011
So when i add issue 'part 1' the date starts # the start date, when i add hours or 'parts' it continues to use the start days until it reaches 8 hours and continues to the next day.
Also when im adding a row between the existing rows it automatically recalculates the dates.
Anny ideas where to start? Tnx
If I understand what you are asking correctly, and assuming start date is in Cell B1, and hours in 1 day B2
And data header in A4:C4, with data below
Then put the formula '=$B$1+INT(SUM($B$5:B5)/$B$2-0.1)' in C5
Copy C5 down and it should generate the date automatically
The '-0.1' is to account for exactly 8 hrs being allowed in 1 day

Resources