I have the above sales order data which lists a day by day update of orders as they go through each stage until shipped. Orders 1 and 2 are shown alongside the status of that order for each date between 1st and 08th February.
What I need to do (in a pivot eventually), is to count the number of days for each order that they were in each state. So for example Sales number 1 was in a processing state for 4 days and a packed state for 3 days and then finally a shipped state for 1 day. I want these 3 numbers displayed beside each status maybe on a separate line?
For example
Sales Number 1
Processing - 4 Days
Packed - 3 Days
Shipped - 1 Day
You'll also notice that on Sales Number 2, the order went back into a "On Hold" state, this can occur in my dataset so just count it as normal e.g On Hold - 2 days.
How would I get this count using a formula or pivot etc?
Simplest way is to use pivot table:
Related
I have an excel file that has 2 spreadsheets. First spreadsheet ("masterlist") contains the masterlist with 4 columns:
CustomerID
Checkin
Checkout
Duration
1
9/1/2020
9/3/2020
A customer might have multiple entries as they could've checked in and out multiple times. There's thousands of records/rows overall.
The 2nd spreadsheet ("Infosheet") just has ONLY the unique customers from masterlist and is structured:
CustomerID
Total_Duration
1
My end goal is to calculate the total duration of each customer's stay.
For calculating Duration in "masterlist," I did a simple if statement formula:
=IF(checkout=checkin,1,checkout-checkin+1)
If statement, because if the checkin and checkout are on same day, the customer is still considered to have stayed 1 calendar day. The addition of 1 in the false case is done to account for the same full calendar day. So a stay of 9/1-9/3 should yield 3 days total.
Long story short, I ended up with a formula that reads the following for the "Infosheet"'s Total_Duration:
=SUMIF(masterlist!$A:$A,A2,masterlist!$D:$D)
Problem is that there's multiple assumptions made using my logic that ends up getting multiple records wrong.
If a customer has the following two records:
Checkin
Checkout
Duration
9/1/2020
9/3/2020
3
9/3/2020
9/5/2020
3
My formulas calculate the duration of stays for both as 3 days and in the "Infosheet" the total duration would show as 6 days. The correct result would have been 5 days, because we shouldn't be counting 9/3/2020 twice.
My formula also doesn't account for a case like the one below:
Checkin
Checkout
Duration
9/1/2020
9/3/2020
3
9/3/2020
9/3/2020
1
10/1/2020
10/3/2020
3
10/3/2020
10/3/2020
1
While the duration, in isolation, are calculated correctly, the SUMIF would give us a total duration of 8 days. In reality, the 9/3-9/3 and 10/3-10/3 stays have already been accounted for in the 9/1-9/3 and 10/1-10/3 stays so it shouldn't have been counted again and the total duration should've been 6 days.
I am completely stumped on what should be my next step. How do I account for these examples in my formula? How should I be manipulating the data/changing or adding columns to make this easier?
Thanks in advance!
we can use Sequence to create an array of days from the Min to the Max dates and use COUNTIFS to find if they fall inside the ranges.
=LET(
ID,A:A,
ckin,B:B,
ckot,C:C,
ids,F2,
mn,MINIFS(ckin,ID,ids),
mx,MAXIFS(ckot,ID,ids),
sq,SEQUENCE(mx-mn+1,,mn),
SUMPRODUCT(--(COUNTIFS(ckin,"<="&sq,ckot,">="&sq,ID,ids)>0))
I have a financial model in which Occupancy numbers vary depending on when the construction phase has been completed. I have another cash flow tab which should show in Year 1 occupancy numbers regardless of when they were completed in the other tab.
i.e. Occupancy Begins Month 10 in Development Tabs: 500 sqft. In Cash Flow Tab - Year 1/Month 1: sqft and so on.
Is there any clever way to do this in Excel?
Very much struggling
I tried using HLOOKUP but fall short with the dates end.
I have attached an example:
Please note the HLOOKUP references Table 1 Top Row '16' with the Table 2 16 - with the result just below Table 1. Basically I am trying to assume whenever Occupancy starts it translates into Month 1 in my table
Example:
I have a dataset in excel which shows headcount by employee level and which department each employee would fall under (sales, ops, or support). I would like to send a survey to each employee once every 26 weeks (2 times a year), but I would also like to keep sending surveys every week to ensure continuation of surveys to a certain amount of population split between sales, ops, and support departments based on their weight of the total population.
This way, I am sending surveys every week to a tiny bit of my overall headcount but only repeating people every 26 weeks.
Can anyone please help on how to solve this in excel with a formula?
From attached sample data, how can I split the headcount to send surverys for 26 weeks straight but to different population every week and not repeat? This different population should be split by % of department out of total headcount. Meaning if I have 10 people every week and % split is 40% sales, 30% operations, and 20% support, the survey should be sent to 4 sales, 3 operations, and 2 support people. Please note that the 10 people and the %s may vary every week because of new hires and resignations.
Thank you!
Sample Data
In the data sheet, ceate a helper column D, where you hand out the numbers to each employee, label it MOD. Use the formula for each employee, enter to cell D2:
=MOD(ROWS(A$2:A2)-1;$H$2)+1
That way each employee is assign a number from 1 to whatever is in the cell H2, e.g. 26. Then contact list all employees with 1 and you have the first batch and so you continue each week to get to employees with 26 in 26 weeks. This way all get the survey but just once.
Of course the share of the individual depts cannot be achieved each time, as there are less employees in some. If you wanted to keeps the shares, some employees of the smaller departments would get the survey more times.
If you want to get some randomness into the order, just mix the order of MOD numbers, e.g. start with 7, continue with 23 etc.
I hope I got the question right, I am not sure in some parts.
This is driving me nuts.
I have a table of sales information based on dates as followed.
Date Price
1/1/12 5
2/1/12 5
12/1/12 5
Now i've used a pivot table firstly to group by week, then count the number of values for sales and tally up the Price as followed
Week Quantity Revenue
1/1/12 - 7/1/12 2 10
8/1/12 - 15/1/12 1 5
I have a 'quota' or desired quantity per week which is 3 and i'd like another column that subtracts 3 from the quantity to give me a difference like so.
Week Quantity Revenue Difference
1/1/12 - 7/1/12 2 10 -1
8/1/12 - 15/1/12 1 5 -2
I've tried adding a formula to do this but firstly i can't access the quantity column because its not a field and i can't work out the formula to make a field to replace the quantity column. Any ideas?
The only way I can figure to do it is to change the source data and add Quota and Quantity columns to it. The quota has to be calculated so that it adds up to the desired amount per week, in this case 3.
The formula for the quota calculation is:
=($F$2/7)/COUNTIF($A$2:$A$22,A2)
You can then make a calculated field, here shown as "Sum of Field 1":
This isn't a very manageable solution. And if you have multiple products and/or different quotas it will get uglier fast! But it's the best way I can see to do it with a pivot table.
I have a list of E-mail addresses and order dates. I am trying to figure out how to display the number of customers that order every week, twice a month, once a month, once every 2 months, once every 3 months, once every 4 months, and once every 5 months or more.
What is the best way to accomplish this is? I have 400K records.
I'd suggest a pivot table that counts dates by e-address. With say 12 months of data Count of date = 6 is once every 2 months (on average!) =12 is once every month. That does not deal with an e-address that ordered 4 times in the last month of the year but I am not sure that is your requirement because if ordered on the last day of the year the frequency could be any of your options.