Extract a unique distinct list based on a condition [Pivot Table]
Anura asks:
I have a list of credit card transactions showing the name of the cardholder, their Branch and the amount. I want to produce a report for each Branch, so what I want is to extract only those people who match the Branch name. For example:
Frank Branch A
Frank Branch A
Frank Branch A
Joe Branch A
Mary Branch B
Jane Branch C
Mike Branch A
Joe Branch A
Dave Branch C
I would like a list of only those people for Branch A, and then be able to summarise the transactions. Or should I do this in two stages?
How can I count the number of transactions per person?
Answer:
First create a named dynamic range. If you add new values to your list the named range expands. This makes it easy to update your pivot table with newly added values. Then create a pivot table.
How to create a dynamic named range
This dynamic range formula adds both new columns and rows.
- Press with left mouse button on "Formula" tab on the ribbon
- Press with left mouse button on "Name Manager"
- Press with left mouse button on "New"
- Type a name for the range, I named it "table"
- Type this formula into "Refers to:" field:=OFFSET(Table!$A$1, 0, 0, COUNTA(Table!$A:$A), COUNTA(Table!$1:$1))
- Press with left mouse button on OK
The above table has the cell range $A$1:$C$11.
The dynamic range formula =OFFSET(Table!$A$1, 0, 0, COUNTA(Table!$A:$A), COUNTA(Table!$1:$1)) returns the same cell reference $A$1:$C$11.
How to create a pivot table in excel 2007
- Select cell range A1:C11
- Press with left mouse button on "Insert" tab on the ribbon
- Press with left mouse button on "Pivot table" button
- Type "table" in "Table/Range:" field
- Select where you want the pivot table to be placed
- Press with left mouse button on OK
I placed the pivot table on a new sheet.
- Drag and drop "Name" to "Drop Row Fields Here"
- Drag and drop "Branch" to "Drop Column Fields Here"
- Drag and drop "Amount" to "Drop Column Fields Here"
How to create a list of unique distinct values for branch A
- Press with left mouse button on Branch arrow
- Deselect all but Branch A
- Press with left mouse button on OK!
How to count the number of transactions per person
Drag and drop "Name" into "Values". See picture below.
How to update pivot table with new values
- Add more values to table
- Press with right mouse button on Pivot table
- Press with left mouse button on "Refresh"
Pivot table category
Table of Contents Introduction to pivot tables Create pivot table Group data Analyze data (pivot table) Compare performance, year to […]
Rodney Schmidt asks: I am a convenience store owner that is looking to make a spreadsheet formula. I want this […]
In a previous post:Â How to create a dynamic pivot table and refresh automatically I demonstrated how to refresh a pivot […]
Excel categories
Leave a Reply
How to comment
How to add a formula to your comment
<code>Insert your formula here.</code>
Convert less than and larger than signs
Use html character entities instead of less than and larger than signs.
< becomes < and > becomes >
How to add VBA code to your comment
[vb 1="vbnet" language=","]
Put your VBA code here.
[/vb]
How to add a picture to your comment:
Upload picture to postimage.org or imgur
Paste image link to your comment.