Display the 3rd highest value of each week - excel

I have Data with a Price Column and a Week Column and I want to display the 3rd lowest price for each of those weeks. I know about the Large function and am assuming that there is a way to combine array formulas with that to receive the wanted results but am stuck on that thought.
Setup:
Week| Price
01 100
01 300
01 200
02 500
02 300
02 600
I want to automatically have the 3rd best price for each of those weeks available so Week 1 : 100 and Week 2: 300, keep in mind that each week has way more pricepoints than 3.
If anything is unclear feel free to ask.

Let's suppose your data would fill a table A1:B6.
In column C write the following formula:
=SUMPRODUCT(($A$1:$A$6=A1)*(B1<$B$1:$B$6))+1
This will rank all the values in column B based on the same value of column A. You will end up with the following table:
1 100 3
1 300 1
1 200 2
2 500 2
2 300 3
2 600 1
All you have to do is to take the rank=3.

Related

Excel Average Calculation of a Moving Criteria Range

I need to create a logic excel formula that calculates the average of 3 months prior to a specified start date. There are multiple start dates. For instance:
For ID 1, The Start Date is May-2021. I would need for the logic to calculate the average between Feb-2021 to Apr-2021 to get 91.67. For ID 2, the Start Date is Jun-2021, so I would need to calculate the average of Mar-2021 to May 2021 to get 108.33. I also would need to calculate the average of 6 months prior in a separate column.
ID
Start Date
Calculation Result
Jan-2021
Feb-2021
Mar-2021
Apr-2021
May-2021
Jun-2021
1
May-2021
91.67
50
100
75
100
25
0
2
Jun-2021
108.33
0
25
100
175
50
125
3
Apr-2021
83.33
100
150
0
75
0
200
Any help is greatly appreciated! (Not opposed to VBA suggestions either)
use INDEX to create the range.
=AVERAGE(INDEX(D2:I2,MATCH(B2,$D$1:$I$1,0)-3):INDEX(D2:I2,MATCH(B2,$D$1:$I$1,0)-1))
Or if they are true dates we can use AverageIfs:
=AVERAGEIFS(D2:I2,$D$1:$I$1,">"&EOMONTH(B2,-4),$D$1:$I$1,"<="&EOMONTH(B2,-1))

Sum a Column if it matches a Criteria in one formula - is it possible?

I have two columns of revenue figures of different brands: Example
US UK
Brand 1 100 0
Brand 2 200 50
Brand 3 100 40
Brand 4 0 20
What I am trying to do is SUM the UK column IF and only if US AND UK are bigger than 0 (Revenue>0), Therefore my output would be 90.
How do I do this in one formula - is it possible?
Thanks
Try SUMIFS() like.
=SUMIFS(C2:C5,B2:B5,">0",C2:C5,">0")

Excel formula that returns sum based on categorical and date data from 2 columns?

I have a dataset in excel that looks like this:
Supplier Date QTY
A 03/02/2018 10
A 05/01/2018 15
A 08/06/2018 30
B 02/01/2018 20
B 04/01/2018 50
B 08/01/2018 40
B 08/15/2018 50
B 10/01/2018 60
C 03/09/2018 25
C 04/08/2018 25
C 05/20/2018 25
And I want to make a spreadsheet that allows the user to enter start and end dates and the Supplier name and be able to see a total quantity of items received in that time period from that supplier.
I've tried using a combination of VLOOKUP and SUM, but I've only been able to get the first result of the quantity associated with that supplier to return. I understand that this is the nature of VLOOKUP--to only return one value. I'm pretty new to Excel so I just don't really even know which function(s) would be best to use in this scenario.
Example Output:
Enter Supplier: "B"
Enter Start Date: "03/01/2018"
Enter End Date: "09/01/2018"
Items Received: 140
Try:
=SUMPRODUCT((A2:A12=F1)*(B2:B12>=F2)*(B2:B12<=F3)*(C2:C12))
Result:

Select the majority value

I have the following Excel spreadsheet:
A B C D
1 Sales Price Sales Price Sales Price
2 January February March
3 Year 01 50 70 90
4 Year 02 50 60 40
5 Year 03 60 70 30
6 Year 04 40 60 50
7 Year 05 50 40 25
8
9 Majority Sales Price: 50 70 90
In Rows 3-7 you see the sales price of a product from the months January-March in 5 years (Year 01 - Year 05).
In Row 9 I want to select the sales price which has the majority within each month.
For example in January the sales price of 50 has the majority because it appears both in Year 01 and Year 02.
Please keep in mind the following criterias:
a) If there is no majority of a sales price the highest sales price should be picked. (Cell D9)
b) If two or more sales prices have the same majority the higher one should be picked. (Cell C9)
What formula do I need to get my desired result?
In cell B9 enter the following formula as an array, i.e. Ctrl+Shift+Enter:
{=IFERROR(MAX(MODE.MULT(B3:B7)), MAX(B3:B7))}
This uses MODE.MULT to find the modal value(s), which returns the result as an array. If there is more than one modal value, MAX returns the highest out of that array. If there is no modal value, MODE.MULT throws an error, hence the IFERROR statement which is used to find the max value in the error case.

Averaging aggregated(SUM) values in Spotfire

I'm trying to Average aggregated(SUM) values, but my expression keeps doing weighted averages over the whole data set.
Table Structure
REGION SITE_ID MONTH QUANTITY
A 1 01 5
A 1 02 6
A 2 01 4
B 3 01 10
B 3 02 12
Expression
Avg(
Sum([quantity]) over (All([region]))/
UniqueCount([site_id]) over (All([region]))/
UniqueCount([month]) over (All([region]))
) over (All([region]))
To Clarify, I want to average A and B's Monthly Qty per Site
But I keep getting total qty divided by total no of site_ids divided by months
This really depends on where you are going to use it and what the REAL data looks like. This should get you started. Insert this calculated column.
SUM([QUANTITY]) OVER (Intersect([REGION],[MONTH])) / UniqueCount([REGION]) AS [AvgOverRegionByMonth]
This could be inaccurate depending on how the rest of your data looks like. You can also accomplish this in a cross table. The expressions for the Sum and Avg on the example below are as follows:
Sum([QUANTITY]) as [Sum], Sum([QUANTITY]) / Count([REGION]) as [Average]
EDIT
In order to ONLY get the average over the months, use this forumla:
AVG([QUANTITY]) OVER ([MONTH]) as [AvgOverMonth]
Here is what your data will look like:

Resources