Calculate Monthly Highest Selling Product - MS Excel - excel

I am trying to figure out how to get the product with the highest sales per month using Excel. I'm new to excel and it's been a struggle understanding what formula to use.
Please help!

Use a Pivot Table to summarize the data. Use these columns in your fields:
Click the dropdown arrow in the Product column, choose value filters, Top 10. Choose top 1 by sum of sales:

Screenshot(s) refer:
Setup
Sample data (B:M) and unique product ID / unit cost list (O:Q)
Note: Unique product List ony required for Method 3 - see below
Notice col M 'Sales' derived as Store cost / unit cost:
=F4:F29/INDEX(Q4:Q10,MATCH(D4:D29,P4:P10,0))
Only relevant if transactions comprise 1 or more sales of a given product (here, transactions 1001, 1008 comprise 3 pool covers and 4 pool domes resp.). This is covered under method 3 (can also be handled by method 1, albeit only the single product/trans is given in that example).
Methods
Pivot Table method - can handle 'single' or 'multi' product variations
Countifs method - only for 'single' product per trans
Sumifs method - as for pivot table method
1. Pivot Table
(quick but not v. dynamic - i.e. requires refreshing)
a) Select the sample data, and click 'Analyse Data' in Home section of main ribbon:
b) In the 'Ask a question about your data' search bar, type 'Which is the most common 'Product' each month?
c) Select 'insert Pivot table'
Notes:
You may need to sort row labels if you want this to read chronologically Jan->Apr
You can try different variations or select one of the suggestions to allow or other summaries, e.g. by $ sales / multi-product variation etc
2. Max number of sales per month (1 sale per transaction)
requires Office 365 compatible version of Excel
Obtain unique list of months:
=UNIQUE(B4:B29)
Obtain complete & unique lists for Product IDs each month, for unique lists, determine corresponding count of product IDs (countifs); then join the filtered list corresponding to product ids with max counts using text join -
=LET(x_,TRANSPOSE(SORT(UNIQUE($D$4:$D$29))),y_,TRANSPOSE(COUNTIFS($D$4:$D$29,TRANSPOSE(x_),$B$4:$B$29,S4)),TEXTJOIN(", ",1,FILTER(x_,--ISNUMBER(MATCH(y_,IFERROR(COLUMN(y_)/0,MAX(y_)),0)))))
Option 3 - multi product/transaction
As for option 2 (Office 365, unique month, complete/unique lists, etc.) but now countifs replaced by sumifs, and col M (# sales, cf. set up) utilised:
=LET(x_,TRANSPOSE(SORT(UNIQUE($D$4:$D$29))),y_,TRANSPOSE(SUMIFS($M$4#,$D$4:$D$29,TRANSPOSE(x_),$B$4:$B$29,S4)),TEXTJOIN(", ",1,FILTER(x_,--ISNUMBER(MATCH(y_,IFERROR(COLUMN(y_)/0,MAX(y_)),0)))))
Notes:
Product codes 9822 (Jan) and 1002 (Feb) outrank other products returned by Option 2 due to multi-product sales (3 and 4 resp.).
This method is most robust as it can be used to return Product Codes with the highest profit/commission etc. (simply by altering values in col M).
E.g. setting col M = £Commission yields the following 'highest commission earning Products' each month:
In this case, Products 1002 and 1003 dominate - given their sales volumes and high unit costs (comm. assumed 20% flat across each product otherwise).
General points
Notes:
Assuming you intended to insert table as follows:
| A| B| C| D| E| F| G| H| I| J| K |
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |
| Month | Transaction Number | Product Code | Product | Store Cost | Sale Price | Profit | Commission | First name | Last name | Sale Location |
| Jan| 1001| 9822| Pool Cover| $58.30 | $98.40 | $40.10 | 8.02| Charlie| Barns| NM |
i.e.
A
B
C
D
E
F
G
H
I
J
K
Month
Transaction Number
Product Code
Product
Store Cost
Sale Price
Profit
Commission
First name
Last name
Sale Location
Jan
1001
9822
Pool Cover
$58.30
$98.40
$40.10
8.02
Charlie
Barns
NM
☺

Related

How to sort a column based on exact matches with another column

I have an inventory table that looks like this (subset):
part number | price | quantity
10115 | 14.95 | 10
1050 | 5.95 | 12
1074 | 7.49 | 8
110-1353 | 13.99 | 22
and i also have another table in sheet 2 that looks like this (subset):
part number | quantity
10023 | 1
110-1353 | 3
10115 | 2
20112 | 1
I want to basically subtract the quantities in the second table from the ones in the first table. What is the best way of doing this? I have looked in to VLOOKUP and INDEX MATCH but they are not quite right for this. Would this perhaps actually be better in say an Access DB ?
I have add another two columns next to sheet 1 last column. Let us assume that the second table range is A1:B5.
Image:
Formulas:
Column D:
=IFNA(VLOOKUP(A2,Sheet2!$A$2:$B$5,2,FALSE),0)
Column E:
=C2-D2
If you wanted to tackle this using MS Access, the SQL code might look like this:
select
t1.[part number],
t1.price,
t1.quantity - nz(t2.quantity, 0) as qty
from
inventory t1 left join table2 t2 on t1.[part number] = t2.[part number]
Here, I assume that you have a table called inventory and a table called table2 (change these to suit your database).
A left join is used to ensure that all records from inventory are returned, regardless of whether a match is found in table2, and the Nz function is used to return 0 for records for which there is no part number match in table2.

Excel Sumproduct/Sumif based on multiple criteria across two tables not in order

I've been struggling with an issue for a while now and haven't been able to find a solution, so any help would be greatly appreciated!
I'm trying to build a formula that sums up values from a column based on criteria spread across two tables (I've simplified below):
Table 1
+-------------+---------+---------------------+------------+----------+------+
| Customer ID | Twin ID | Customer Entry Date | Exit Date | Spending | Days |
+-------------+---------+---------------------+------------+----------+------+
| 111 | 333 | 24.12.2015 | 28.05.2018 | 5000 | 200 |
| 222 | 444 | 19.06.2014 | | 4000 | 300 |
+-------------+---------+---------------------+------------+----------+------+
Table 2
+-------------+---------+---------------------+-----------+----------+------+
| Customer ID | Twin ID | Customer Entry Date | Exit Date | Spending | Days |
+-------------+---------+---------------------+-----------+----------+------+
| 444 | | | | | 200 |
| 333 | | | | | 0 |
+-------------+---------+---------------------+-----------+----------+------+
I now need to find a formula, that will allow me to sum up the column "Spending" from table 1 based on the following criteria:
"Twin ID" in Table 1 is not empty and the value matches the value "Customer ID" in Table 2 --> this has been the main complication for me, as the Customer IDs in Table 2 are in a different order than the Twin IDs in Table 1
"Entry Date" in Table 1 is < a specific date
"Exit Date" in Table 1 is >= a specific date or empty
"Days" in Table 2 is >0 (for the respective Customer ID that matches the Twin ID from Table 1)
Or in other words: "If customers 111,222 etc. have a twin, and this twin has days >0, and the entry and exit dates of the customer are < > a specific date or empty, then sum up the spending of those customers"
I've tried various iterations of the SUMPRODUCT formula, and this one currently works as long as the two tables are in the same order (i. e. Twin ID "333" is in row 2 in Table 1 and in row 2 in Table 2):
=SUMPRODUCT(--(Table1!Customer Entry Date<DATE1);--(Table1!Exit Date>=Date2);--(Table1!TwinID<>"");--(Table2!Days>0);Table1!Spending)
Is there any way to make this formula work regardless of the order of the row items (i. e. Twin ID "333" is in row 2 in Table 1 and in row 3 in Table 2)?
Any help would be greatly appreciated!
Try this
=SUMPRODUCT((Table1!Customer_Entry_Date<Date1)*(Table1!Customer_Entry_Date>Date2)*(Table1!Twin_ID<>"")*(COUNTIFS(Table2!Customer_ID,Table1!Twin_ID,Table2!Days,">0")>0)*Table1!Spending)
It's similar to your formula, but uses Countifs to see if a matching Customer ID for Table 1's Twin ID is anywhere in table 2.
Note that your named ranges (if that's what you're using) should not include the column headers or else you'll get a #Value error when it tries to do the multiplication.
You could avoid it by putting IF(Isnumber()) around the last part of the bracket, but then it would have to be entered as an array formula
=SUM((Table1!Customer_Entry_Date<Date1)*(Table1!Customer_Entry_Date>Date2)*(Table1!Twin_ID<>"")*(COUNTIFS(Table2!Customer_ID,Table1!Twin_ID,Table2!Days,">0")>0)*IF(ISNUMBER(Table1!Spending),Table1!Spending))
I managed to solve the issue.
Anyone facing a similar problem, please see the example file for solution: https://wetransfer.com/downloads/90aedc5943f52274e36102a79e23c18e20180628212338/2fd1c1
=+SUMPRODUCT(SUMIF(Table1TwinID;Table2CustomerID;Table1Spending)*(Table2Days>0)*((COUNTIFS(Table1TwinID;Table2CustomerID;Table1EntryDate;"<"&DATE1)*COUNTIFS(Table1TwinID;Table2CustomerID;Table1ExitDate;">="&DATE2))+(COUNTIFS(Table1TwinID;Table2CustomerID;Table1EntryDate;"<"&DATE1)*COUNTIFS(Table1TwinID;Table2CustomerID;Table1ExitDate;""))))

Excel syntax for getting the value in another table based on 2 cells

I would like to know what is the best syntax if i want to get the price of an item depending on the specific product and its unit of measure because a product can be sold per bag or per kilo. Here's a sample content of excel sheet. The only required input for the user is the enter product name and unit of measure in the Orders Sheet.
Orders Sheet
Item Purchased | Unit | Price
-------------------+----------+---------
Product 1 | Bag | 1000
Product 1 | Kilo | 100
~~~~~~~
Price List Sheet
Item | Unit of Measure | Price
----------+---------------------+--------
Product 1 | Bag | 1000
Product 1 | Kilo | 100
Product 2 | Bag | 2000
You can use SUMIFS, which can be used specifically when the result you want is a numeric value:
=SUMIFS(C:C, A:A, E2, B:B, F2)
That's assuming though that your price list is a true price list, meaning no item is duplicated (e.g. Product 1, Bag doesn't appear more than once).

How to get two+ rows to link together? Excel 2010 (Example)

I have a parts list with competitor pricing. One part number brings multiple brands up with the location of the company.
As you can see from the picture, I have part numbers for one item with three companies. I want to sort by part type. So for example I want to list only the brake pads. When I do this the blanks get sent to the bottom, but the blanks are not really blanks because they have additional info with them for that part number.
Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Column 6 | Column 7
Part No | Company A | Price | Company B | Price | Company C | Price
4656546 | Brand A | $5 | Brand A | $5 | Brand A | $5
(BLANK) | Brand b | $8 | Brand b | $8 | Brand b | $8
I have tried to use a helper column, but I have 1,000+ rows.
Does anyone know if you can link or have a relationship between two+ rows?
I hope you understand and if not. I can try to explain better.
I asume that a "blank" in PartNo means "take the PartNo from the cell above" ...
In order to normalize the PartNo (= get rid of the blanks) use another PartNo-Normalized column (e.g. [K:K]) and normalize as following:
K1 ="PartNo-Normalized"
K2:Kxx =IF(A2<>"",A2,K1)
Next convert all formulas in [K:K] into values !!! (Copy / PasteAs - Values) before sorting ... as a sort operation will destroy the calculated values.
After conversion to values it's save to sort, and you may create a filter on that column.
Depending on how well organized your data is, it might be a good idea to add one more column and fill it with 1, 2, 3, 4, 5 ... before any sorting so you can restore the original sort order just in case something nasty happens.

Using Dynamic fields/values in SUMIFS

I have one large DATA table that is refreshed from a SQL Server.
Example DATA table, 6 x string values and 5 x numeric values:
AREA | COUNTRY | CATEGORY | SALES GROUP | AAA | BBB | SALES $ | COSTS | VAL1 | VAL 2 | VAL 3
I have second, SUMMARY table with a number of columns that match field names in the DATA table. These are broken down so you can see summary values at different levels:
BREAKDOWN | SALES $ | COSTS | VAL1 | VAL 2 | VAL 3
EUROPE SUMIFS | SUMIFS | SUMIFS|SUMIFS|SUMIFS
- ENGLAND
- - SMALL BUSINESS
- - - Joe Green
- - - Molly Mongers
- - - Patent Felicity
- - CORPORATE
- - MAJOR
- FRANCE
- GERMANY
- AUSTRIA
I've got a SUMIFS statement which I want to make more dynamic so it references column names to retrieve different data:
=SUMIFS(qryDATA[COSTS],qryDATA[AREA],"Europe",qryDATA[COUNTRY], "France")
I can change the Criteria VALUES to be dynamic thus:
=SUMIFS(qryDATA[COSTS],qryDATA[AREA],D9,qryDATA[COUNTRY],'EXEC VIEW'!AC6)
But if I try the same with SUM field or CRITERIA FIELDS, I get an error (won't accept entry {There's a problem with this formula}). AD8 contains the text COSTS:
=SUMIFS("qryDATA[" & AD8 & "]",qryDATA[AREA],D9,qryDATA[COUNTRY],'EXEC VIEW'!AC6)
How can I get the sum field name (COSTS) from the 1st/2nd examples, to be a cell reference?
Thnx
Try this:
=SUMIFS(INDEX(qryDATA,0,MATCH(AD8,qryDATA[#Headers],0)),qryDATA[AREA],D9,qryDATA[COUNTRY],'EXEC VIEW'!AC6)

Resources