How to count the number repeated product purchased by the same customer based on - excel

I have a table with
customer identifier (email)
order number (1 refers to the first order one has placed, 2 is the 2nd)
SKU is the product identifier.
I want to see a table that has two columns:
SKU
the number of times this product has been showed in both the 1st and 2nd order of the same customer. Or in other words, how many times the product has been ordered repeatedly.
Something like this:
What excel function could achieve this?

You can achieve this with a helper column using COUNTIFS, and then a pivot table:
Helper column formula:
=--(COUNTIFS(A$2:A2,A2,C$2:C2,C2)>1)
Add a value filter to the pivot table to only show rows with a value greater than 0.

You can also create a Power Pivot table to count distinct orders and create a measure to count repeat orders.
Here, column F is the Distinct count of customer and column G is the total count of customer for each SKU. Columns H and I are measures you can create with power pivot.

Related

Copy entire rows that has unique value on Excel

I have a table with several rows which may contain an equal value (specifically the product code) I have to create another table with a summary of the quantities of the products, so for example, if I have 3 identical products in table 1, in the summary table I only need to have one time that product code with a column that will show me quantity = 3 and the other columns must be filled in with the other product information, on google sheet I managed to do it with this formula: =unique(query(scan!b5:j,"select b,c,d,e,f,g,h",1))
EXAMPLE
how do I do this with excel functions?

Sum of specific number of rows for a id in excel

I am pretty new to excel formulas. I want to calculate the sum of prices for every unique id. Using SUMIF I was able to do that for every unique id but I only want to calculate the sum of a number of rows for that id.
=SumIF(A:A;C2;B:B)
Sample data is attached. Actual data set is quite large. For Example, For Id 1, I only want to calculate the sum of first 3 rows (Column price) corressponding to that id, for id 2 the sum of first 4 rows and so on.
Sample data:
This formula works for sorted and non sorted data:
=SUMIF($A$2:INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$20)/($A$2:$A$20=C2),D2)),C2,$B$2:INDEX(B:B,AGGREGATE(15,6,ROW($A$2:$A$20)/($A$2:$A$20=C2),D2)))
Enter this as an array formula (ctrl+shift+enter):
=IFERROR(SUMPRODUCT(IF(ROW($A$2:$A$20)>SMALL(IF($A$2:$A$20=C2,ROW($A$2:$A$20),FALSE),MIN(D2,COUNTIF($A$2:$A$20,C2))),0,1),IF($A$2:$A$20=C2,1,0),$B$2:$B$20),0)

Need help in excel formula

1) I have two tables. 1st table contains data for more then 20,000 rows and 2nd table I already have the following columns details i.e. Region, Item, Number and I just have to get the Total value of the product from the 1st table
2) There are two types of prices in the 1st table . One is Retail Price and Another one is a Wholesale price
3) In each of the regions Rep, Item and Numbers are same in most of the cases, but the Total price is different
4) I am able to get the Total price details in 2nd table through vlookup formula (After concatinating the following columns i.e. Region, Item and Number from both the tables) wherever there is an account number for retail price
5) Currently I am manually updating "Total Price" details in 2nd table for Wholesale price which is taking lot of time.
Is it possible to build a formula to get the wholesale price details in the 2nd table, since there are more then one account number, but the price is same
If the wholesale price is the lowest price for the specific item, then you can find it with the formulas MIN and IF.
Based on your screen shot:
D is the column with the list of items
I5 is the cell with the item name for which you want to find the wholesale price
F is the column with the list of prices
If you enter the following formula in cell K5, it should find the lowest price for pencils
=MIN(IF(D:D=I5,F:F))
On this link, there is an explanation if you want to use multiple criteria.
http://www.contextures.com/excelminmaxfunction.html
try the sumifs function.
It takes multiple arguments and criteria. So it should look something like:
cell value at j5 = sumifs(f3:f23, b3:b23, h5, d3:d23, i5....)
you need to mark off which rows in your first table are wholesale selling. So it should be a column of some kind. Once you do that, let's say in column G, then you add onto the sumifs function...
, g3:g23, L5)
What you're doing is summing up all of the values in column F where h5 (region) matches in b3:b23, i5 (item) match in d3:d23, and where L5 (retail type) match in a new column g2:g23.
This will find all of the values that match that criteria exactly.
Vlookup is useful, but it's harder to scale IMO than the advanced if functions.
SUMIFS is probably the better way to go on this one, but as an alternative there is also SUMPRODUCT.
=SUMPRODUCT(($H3=$B$3:$B$20004)*($I3=$D$3:$D$20004)*($J3=$E$3:$E$20004)*($F$3:$F$20004))
The * acts as an AND statement in a logical check, and each of the ($H3=$B$3:$B$20004) is a logical check. When the row is true it will evaluate to 1. When it is false it will evaluate to 0. in the end you wind up with a list of prices or 0s that get summed. The end result is the sum of everything that matches your criteria.
The danger of using this formula is that it can get labour intensive as it is performing array calculations without being an array formula.

How to use calculate and distinct count together in powerpivot

I want to count the following in powerpivot.
I have a column with customer numbers and then I have another column with status ("paid", "no")
If any of the customer entries are "paid" I want that to count as 1 unique customer. If not, then there is no count.
For example, 1,1,1 and "paid" "paid" "paid" would be equivalent to 1 count.
I tried this
Copy of Calculated Field 1:=CALCULATE(Count(Table1[Claim]),Table1[Invoice]="Paid")
but it essentially counted ALL instances of "Paid".
Are you not just looking for a distinct count?
=CALCULATE(DISTINCTCOUNT('Table1'[Customer_ID]),'Table1'[Invoice]="Paid")

How to calculate with reference id

I have a workbook in which there is stock detail on sheet 1 and sales detail on sheet 2.
I want to auto-calculate the remaining stock. But the sales inventory is based on dates so all the different products are mixed up. Every product has a unique ID. So how I can subtract the sale product from stock based on their IDs?
An example:
The customer comes and buy 4 shirts.
I enter the product with product ID, and in the Qty column I added 4.
Now I want to minus 4 from actual stock.
How it can be done in Excel?
You need to take the sum of all sold products in sheet 2 based on condition that productID in sheet2 equals our interesting product in sheet1. Use:
=SUMIFS(B2:B100,A2:A100,productID)
where column A contains product IDs and column B contains "sold" values.
Then subtract that sum from the stock total in sheet1, e.g:
=B3-(SUMIFS(Sheet2!B1:B100;Sheet2!A1:A100;A3))
where column A contains product IDs and column B includes stock totals.
(note how "productID" from the first expression is here replaced with "A3", i.e. the value of productID column for the current row).
Copying this last formula to other product rows should automatically update the relevant values.

Resources