Create Pivot Table in Excel with 1 column per item - excel

I have an Excel sheet with the following columns:
Customer ID
Date
Purchase Status (values = success, fail, pending)
Maximum number of rows with the same Customer ID is 4
I'd like to turn it into a table (pivot table?) where I have 5 columns:
Customer ID
Purchase 1
Purchase 2
Purchase 3
Purchase 4
That table should have 1 row per customer ID
Purchase 1 Column should show the purchase status for the customer's first purchase (based on earliest date from the Date column)
Purchase 2 column should show the purchase status for the customer's second purchase, etc.
If the customer only had 2 purchases, then only Purchase 1 and Purchase 2 columns should be populated.
So my table would look something like this:
sample table
Would really appreciate any help on how to do this. Thanks!

Here is an example on how to do this...
Data
Click on Insert -> Pivot Table, select table range and where you want the data to go and select the check box - Add this data to data model
You will see the Range in the pivot table field above all the column names -> Right click and select Add Measure.
This will open a new window. Add the Measure Name (PassFailPending in screen shot below)
In the formula section, add =CONCATENATEX(Range,[Purchase Status],", ")
Click on Check DAX formula to make sure the formula is good
Drag the various columns as you would normally create your pivot table as in screen shot below with the formula as the values...
This will create the table. As the totals don't look good, you can ...
Go To Design Tab > Select Grand Totals > Off for rows and columns
This will given below output

Related

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

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.

Excel select rows with missing data and copy the selected rows

I have a big excel file with info of companies and there companyID.
But some companies miss there companyID. So I need to copy dose rows, but I cant find how to do that.
So in this exampel I want copy row 2 and 4
A B
Company CompanyID
1 asd 123
2 sda
3 ads 321
4 sad
You have two options:
filter the column B (CompanyID) where = blank and copy the results into another sheet.
select the entire columns A and B, the insert a pivot table with Company and CompanyID in ROWS. Then FIlter the results to show only the rows where CompanyID is blank.
The second one is more interactive, you just have to refresh the pivot table to get the updated results. Of course, it depends on how many times you have to to this job and how many times the list is being updated.
select all data company name field and company id field.then select filter and sort button in excell.then click company id header and click number filter and then equal and ok

Excel: Index match if date matches month?

I have two excel sheets:
Data:
Column A Column E
01/01/2017 Supplier 1
05/01/2017 Supplier 2
05/01/2017 Supplier 1
Sheet 2:
I am trying to look up the supplier where the month of the date in column A matches the month number in cell F11.
F11 = 1
=IF(ISERROR(INDEX(Data!$A:$I,SMALL(IF(MONTH(Data!A:A)=$F$11,ROW(Data!$A:$A)),ROW(1:1)),5)),"",INDEX(Data!$A:$I,SMALL(IF(MONTH(Data!A:A)=$F$11,ROW(Data!$A:$A)),ROW(1:1)),5))
For some reason this doesn't work and i get no result.
I also need to only list each supplier name the once, unique values. But i believe my formula gives me the same result twice.
Please can someone show me where i am going wrong?
Can't you do this with a pivot table?
Just drag the date field into the columns box, then right-click, choose 'Group' and choose 'months'. Then drag the supplier field underneath it and you should get a list of all unique suppliers by month.
Edit:
Example below.

Excel - trying to identify top 3 sales numbers in column d, and return information from corresponding column a

Excel - trying to identify top 3 sales numbers in column D (D5:D:41), and return information from corresponding column A (A5:A41)
You can get the top 3 with
=INDEX($A$5:$A$41,MATCH(LARGE($D$5:$D$41,ROW(A1)),$D$5:$D$41,0))
Copy down two rows.
You could use a pivot table to very easily get his information.
Select insert a pivot table
Select your data
In the pivot table window place the 'Name' field into the 'Row Labels' box and the 'Sales' field into the 'Values' box.
This should give you a pivot table with a list of people and the sum of their sales, making it very easy to see who comes out top.

Issue with Excel Pivot Table Subtotals / Row Hierarchy

I currently have a pivot table with three row labels. The data in the row labels is grouped as follows:
Customer SKU Grouping YTD PrevYTD
123 ABC Qty 30 20
Sales 500 400
DEG Qty 100 150
Sales 1,000 2,000
The YTD and PrevYTD are columns and the values.
I can do a custom subtotal on the 'Grouping' field and choose Sum and it gives me the totals at the end of the report:
Qty Sum 130 170
Sales Sum 1,500 2.400
This is good to this point, but I also want to have subtotals by customer. What I want to see is the same breakdown under each customer (a total of Qty and a total of Sales) but I cannot get this subtotal to work. When I put a subtotal on the Customer field, it puts a oneline subtotal and is adding the Qty and the Sales together. In this example if I put a subtotal on Customer This is what it will display:
123 Total 1630 2570
Is this possible to do what I am looking for?
Thanks for the help!
How about making Grouping a column label instead? It will change the layout somewhat but will allow you to get the effect you are after.
To do this you need to use a second pivot table. It's easier to do it with the tables side-by-side, but you can do it with a table underneath by just deleting the second table and inserting a new pivot table after the last row of the first each time the first table is changed.

Resources