I've had a bit of trouble explaining this so please bear with me. I'm also very new to using excel so if there's a simple fix, I apologize in advance!
I have two columns, one listing number of days starting from 0 and increasing consecutively. The other column has the number of orders delivered. The two correspond to each other. For example, I've typed out how it would look below. It would mean that there were 100 orders delivered in 1 day, 150 orders delivered in 2 days, 800 orders delivered in 3 days, etc.
Is there a way to get summary statistics (mean, median, mode, upper and lower quartiles) for the number of days it took for the average order to get delivered? The only way I can think of solving this is to manually punch in "1" 100 times, "2" 150 times, etc. into a new column and take median, mean, and upper & lower quartile from that, but that seems extremely inefficient. Would I use a pivot table for this? Thank you in advance!
I tried using the data analysis add-on and doing summary statistics that way, but it didn't work. It just gave me the mean, median, mode, and quartiles of each individual column. It would have given me 3 for median number of days for delivery and 300 for median number of orders.
Method 1
The mean is just
=SUMPRODUCT(A2:A6,B2:B6)/SUM(B2:B6)
Mode is the value with highest frequency
=INDEX(A2:A6,MATCH(MAX(B2:B6),B2:B6,0))
The quartiles and median (or any other quantile by varying the value of p) from first principles following this reference
=LET(p,0.25,
values,A2:A6,
freq,B2:B6,
N,SUM(freq),
h,(N+1)*p,
floorh,FLOOR(h,1),
ceilh,CEILING(h,1),
frac,h-floorh,
cusum,SCAN(0,SEQUENCE(ROWS(values)),LAMBDA(a,c,IF(c=1,0,a+INDEX(freq,c-1)))),
xlower,XLOOKUP(floorh-1,cusum,values,,-1),
xupper,XLOOKUP(ceilh-1,cusum,values,,-1),
xlower+(xupper-xlower)*frac)
Method 2
If you don't like doing it this way, you can always expand the data like this:
=AVERAGE(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1))
=MODE(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1))
=QUARTILE.EXC(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1),1)
=MEDIAN(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1))
and
=QUARTILE.EXC(XLOOKUP(SEQUENCE(SUM(B2:B6),1,0),SCAN(0,SEQUENCE(ROWS(A2:A6)),LAMBDA(a,c,IF(c=1,0,INDEX(B2:B6,c-1)+a))),A2:A6,,-1),3)
I have got some list of shops. I have to allocate shipments based on their rankings. The allocation should happen in such a way that each shop should not get less than 25 shipments and more than 100 shipments. The actual question is explained below.
Total SHipments=150
Shop Id A B C D E
Allocation (%) 30% 28% 25% 10% 7%
Min. 25 25 25 25 25
Max. 100 100 100 100 100
Actual Allocation %*150
=45 42 37 15 11
My Requirement 45(>25) 42(>25) 37(>25) 25(<25) 1(<25)
So my requirement is based on the ranking, the excel should allocate actual allocation to the top rankers (Between 25 to 100) and as the ranking goes down, it should fulfil the need of better ranker and make it 25 and then allocate the rest.I think I have made the question clear but let me know if still ambiguity is there. I'm new to this community. Forgive me if I'm not able to post the question in proper way.
To get your required results based on the information in your table layed out in the manner in the screen shot below, use the following formula:
=INT(MIN(MAX($C$1*B$5,B$7),B$9))
The above formula is placed in Cell B16. The INT was used as your results for 37.5 was 37.
In cell C16 place the following formula and copy it to the right as required. This is based on the allocation being in descending order from left to right:
=IF(SUM($B$16:B$16)+INT(MIN(MAX($C$1*C$5,C$7),C$9))<=$C$1,INT(MIN(MAX($C$1*C$5,C$7),C$9)),$C$1-SUM($B$16:B$16))
The max function is used to return the minimum value. When your formula returns a result below the minimum value The max function returns the minimum value. The MIN function does the same when the result of the formula exceeds the maximum allowable value. It will return the maximum allowed value as it is the minimum of the two numbers.
UPDATE: Rank out of order
This does not work when their is a tie and total demand exceeds available shipments
I took your table and added a helper row to determine RANK Row 6. I used the following formula to come up with the rank
=RANK(B5,$B$5:$F$5)
With this method, it is possible to have ties. You can investigate how to come up with unique rank with ties. The rest of this solution will assume the there are no ties in rank.
In Row 11 the "demand" of each shop is calculated based on Max and Min constraints and is rounded down to the nearest integer. The following formula is placed in B11 and copied right:
=ROUNDDOWN((MAX(MIN(B5*$C$1,B9),B7)),0)
In row 13 the actually amount to ship or "supply" is determined with the following formula in B13 and copied to the right.
=IF(SUMPRODUCT(($B$6:$F$6<=B6)*$B$11:$F$11)<=$C$1,B11,MAX($C$1-SUMPRODUCT(($B$6:$F$6<=(B6-1))*$B$11:$F$11),0))
FYI - SUMPRODUCT performs array like calculations within it. As a result, avoid using full column/row references such as A:A and instead reduce the range to your data or something closer to it to avoid a lot of excess calculation which may bog down your system. This is particularly true when the formula is repeated in multiple cells.
I have this pivot table that produce this table,the first column is pending days which represent how long the part is requested till today the next one is part code and next to it I have Total amount of my Inventory. what I want to do is a formula that allocate a number to the fields if their total-amount is > 0.
here is where my problem lies:
if you pay attention to the red ones their total amount is 3 but we have four request from this part and I want for the last one instead of number 1 the formula insert #N/A so that I can Comment correctly.
like this:
appreciate any help in advance.
You can use a COUNTIF function with a relevant and absolute reference to see whether the total amount of parts has already been reached. Try this:
=IF(COUNTIF($B$2:B2,B2)>C2,NA(),1)
Broken down, this formula counts how many of the parts have already been requested and if this exceeds the total amount of parts it will return #N/A, otherwise it will return 1.
My current data is like so:
I use the MIN formula to get the minimum of these times. I am measuring a process time, so the time on T is the least, and T+1 is actually greater. How can I alter my MIN formula to account the 11:51 as the min time?
I can use MAX for above problem, but then when times are 3, 4 , 5 AM, it will give me 5 AM when I want MIN throughout.
One way around this is to add the date to the time. You do not need to display it, but you do need the date as part of the time. JNevill is all over this without coming right out and saying it. You can either do as Jnevil suggest and offsetting all your time by an equal amount so it is all in the same day or you have to add +1 to the time when it crosses the midnight threshold. Adding +1 to your time will tell excel that it is on the following day.
In Excel time is stored as a decimal and days are stored as integers. So any time with no date attached will go from 0.xxx to 1.xxx when +1 is added. The cell will still display xxx as time and the 1 does not enter in to the display. However the 1 will be very important in determining MIN or MAX because of that integer of 0 or 1 out front.
You will probably need to do this through a helper column. Without seeing a column of data it is hard to say if you only need to add 1 or if you will need to add 2 or more depending on how many days the data covers
I am having trouble creating Excel formula for returning a specific value every time my progressive total increases by a certain amount.
Example: I need to purchase 1300m of piping every time the tonnage profile increases by 15000 tons. Assuming my average tonnage increase is about 2700 per month. My progressive tonnages run from C6:AS6. My first month in C6 is Jan 2015 that runs to Jul 2018. My specific value is in C1. My tonnage increment of 15000 tons is in A3. I tried the following formula but it still requires manual input every next increment (at 30000, 45000, 60000, etc)
If(C6>A3,C1,if(C6>(A3*2),C1,if(C6>(A3*3),C1,0)))
This formula still creates a problem because I still need to multiply it manually for every increment increase. Is there a way past this?
If you do
=CEILING(C6/$A$3,1)*$C$1
would that give you what you need - the total meters of piping?
Breaking it into increments of $A$3 (15000) times by the $C$1 1300m of pipe...
EDIT Original version stepped at >= rather than >...
Using FLOOR(C6/$A$3,1) + 1 means that 15000 would need 2... If the switch should be at 15001 (which, looking at your formula it is - you use CEILING