How to rank within category in Excel? - excel

I have a list of customers by region with sales value. I want to create an overall ranking of all customers by sales values as well as the ranking of customers by sales value within the region and use both the ranking to calculate a score. is there a way to do this in Excel?
Either formulae or VBA code would be helpful for me.

Clearly for overall rank you can use RANK function, e.g. with Customers in A2:A100, Regions in B2:B100 and Sales value in C2:C100 you can use this formula in D2 for overall customer rank by sales value (highest ranks 1)
=RANK(C2,C$2:C$100)
for RANK within region you can use this version in E2 copied down
=SUMPRODUCT((B$2:B$100=B2)*(C$2:C$100>C2))+1

Related

How to write an AverageIFS formula in excel when values that have the same identifier need to be summed together and counted as one

I have a dataset of sales data and I need to find the average order value of all customers. If I take the average of all orders the average is lower than expected. This is because a customer will make a large purchase one day and then maybe a smaller purchase a week later and the average formula thinks its two different customers.
So I'm trying to sum the sales values if the client ID is the same and then count is as one. And if there isnt a repeat customer, still use that value in the average.
Say you have a dataset like this:
A1 $1000 A1 $100 A2 $2000 A3 $4000
I want the formula to sum the two values of A1 but only count it as one observation.
so the average should be $7100/3, not $7100/4
The Client ID and sales data are in seperate columns.
I am not sure if I understand your sample data correct:
If so and if you have Excel 365 then you can use this formula:
=SUM(B2:B5)/COUNTA(UNIQUE(A2:A5))

Getting the result for multiple input values

I would like to get the result for multiple percentage values.
Currently, it's only doing it for a single percentage value, e.g. on my screenshot for the -1,0% value.
The Sales row depends on the values from the Sales Growth rates row.
The result with the sums just sums up the values from Sales.
Is there a way to do it efficiently, without adding 3 more Sales Growth rates rows?
Edit:
Sorry I may not have expressed myself correctly.
The first two Sales growth rates have base values pre-defined.
Its values after 2019 are multiplied with $F$69 * -1,00%.
The Sales rows values are all multiplied with the according Sales growth rates values.
Thus I just want the Sales Growth Rates also being multiplied with the other percentages, thus having a sum of sales for each of the 4 percentage values.
One solution for example would be to add 3 more Sales and 3 more Sales growth rates rows, each being multiplied with the 4 percentage values. But that's very inefficient.
Edit2:
This is a screenshot of how it can be done statically in an inefficient way as I mentioned in the last part of my first edit:
My goal is to spare the cells with the green rows as shown in my first screenshot.
I think it is more a mathematical question than an Excel one.
I used a helper column to calculate the growth rates for each scenario.
The formula is =1+A5*$C$3 where A5 is -1% and C3 is 10% under 2019. Drag it down to work out the growth rates for -0.5%, -1.5% and -2%.
Then you can use either of the following formulas to find out the total sales for each scenario:
=SUM($B$2:$C$2,$C$2*(B5+B5^2+B5^3+B5^4+B5^5+B5^6+B5^7+B5^8+B5^9+B5^10+B5^11))
or
=SUM($B$2:$C$2)+SUMPRODUCT($C$2*POWER(B5,ROW($1:$11)))
Drag them down to apply to each scenario.
Let me know if you have any questions. Cheers :)

How to normalize sales distribution percentage across multiple agents using data present in excel?

I am a part of a company that sells a particular product. We have around 5000 agents who are responsible for all the sales in the area. Each agent is given a fixed number of units to sell, and he reports back the number of units solds at EOD. Currently, to assess the performance of all the agents, we simply calculate the percentage of units sold by the agent, and the agent with higher percentage of units sold is considered to be a better salesman.
But as the number of units sold is directly linked to the revenue brought to the company, the agent A should be given some extra weightage while calculating the ranking/percent values. In the current scenrio, even after making the maximum sales, he is currently ranked last just because he was given the maximum number of units to be sold.
I tried normalizing the units allotted column, but that didnt help much.
What can be done here to give a true picture regarding the agent's performance ? . Any help in this regard is appreciated. Currently I am using Excel to maintain this data, but I can switch to any other tool if required.
I would like to suggest to calculate a composite rank that is calculated from the Agents rank in the % of units sold and total units sold. I have calculated composite rank in two ways. First from the absolute values of % of units sold and units sold. Second from Agents relative rank in % of units sold and units sold. Assuming Agents Names in in the range B2:B5 ,% units sold in range C2:C5, units sold in the range D2:D5.
The formulas used are Array Formula, so you must press CTRL SHIFT ENTER rather than ENTER when you first enter the formula and whenever you edit it later. If you do this correctly, Excel will display the formulas enclosed in curly braces { }.
• Formula for relative rank based on % units sold to be CSE entered in range E2
=RANK($C2,$C$2:$C$5)
• Formula for relative rank based on units sold to be CSE entered in range F2
=RANK($D2,$D$2:$D$5)
• Formula for composite score based on % units sold and units sold to be CSE entered in range G2
=(C2/MAX(ABS($C$2:$C$5)))+(D2/(10^(MAX(LEN(C$2:C$5)+1))))+((ROW()/(10^MAX(LEN($D$2:$D$5)+1))))
• Formula for relative rank based as per first approach on absolute values of % of units sold and units sold to be CSE entered in range H2
=RANK(G2,$G$2:$G$5,0)+COUNTIF($G$2:G2,G2)-1
• Formula for composite score based on Agents relative rank in % of units sold and units sold.to be CSE entered in range I2
=(E2/MAX(ABS($E$2:$E$5)))+(F2/(10^(MAX(LEN(E$2:E$5)+1))))+((ROW()/(10^MAX(LEN($F$2:$F$5)+1))))
• Formula for relative rank based as per first approach on absolute values of % of units sold and units sold to be CSE entered in range J2
=RANK(I2,$I$2:$I$5,0)+COUNTIF($I$2:I2,I2)-1
We get different rankings as per snapshot given below. Sample data may not be fully representative of the whole population. So these approaches may please be tried on actual data for optimal decision. Please also see whether sorting base data makes results different because Rank Function is preferred with sorted data. Further reference is HERE
Working copy of exercise file is uploaded to drop box soq_54729849

Use date reference is a vlookup formula

I have attached a printscreen to make it easier to understand my question.
I'm creating a supply management woorkbook. Income will refer to the purchases and outcome the resale of this purchases. Because there will be price variations, I'm looking for a formula to insert on Outcome Total Price that will return the purchase price of the item sold to deduct from the total value of my stock.
I don't know if it's possible to use a second reference on vlookup formula, like to return the price of product A with the condition that it has to be before the date 19/09/2016.
Adriano
Assuming there will be no more than one entry for any given product on any given day, and assuming the data is ordered chronologically, try this in F3 and copy down
=IF(E3>0,SUMPRODUCT($D2:D$3,--($A2:A$3=A3),--($B2:B$3=MAX($B2:B$3))),"")

VLOOKUP + PIVOT TABLE DATA

OBJECTIVE
Given a group of Clients, group each client into "discount" buckets based off of annual sales.
SETUP
Pivot Table with Customer Name, Annual Sales
Table with pricing categories (Bronze, Silver, Gold)
APPROACH
VLOOKUP(ANNUAL SALES, PRICING[ALL],2) - if a client exceeds a certain threshold in the PRICING table, they'll be listed as the corresponding PRICING bucket (e.g "GOLD").
ISSUES/QUESTIONS
VLOOKUP doesn't work well with pivot tables, especially if I collapse parent categories in excel. Is there a way to create a calculation field (that works with the pivot table, regardless whether or not parent categories are collapsed/hidden) that will essentially perform a VLOOKUP on a pricing table?
There is the function GetPivotData which is very powerful to use.
Have a look at this: GetPivotData formula (Contextures)
Bear in mind that the structure of the PivotTable needs to be stable, else you may get unexpected results.
You can also use INDEX / MATCH to get data from PivotTables, advantage of index/match is that you can use the row data as well as the value fields (whereas GetPivotData is limited to value fields).
SOLUTION
By using VLOOKUP and SUMIFS, I was able to develop a formula that would:
Create Pricing Categories
Categorize Customer purchases based off of three attributes (e.g
customer, Product, Configuation) and sum revenue
Categorize Pricing Tier based on total revenue spent
FORMULA
=VLOOKUP(SUMIFS(Sales Revenue, Client ID, Product, Configuration),PRICING TABLE, PRICING TIER, TRUE)
The Formula sums all Sales revenues that match the Client's ID, Product, and the Product's configuration (e.g Total Revenue per Client, per Product). The VLOOKUP formula uses this value and compares against a pricing table.

Resources