excel vb
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Excel VB

Excel VB

resolvedResolved · Urgent Priority · Version 2003

replyReply Fri 24 Oct 2008, 12:12Delegate David said...

David has attended:
Access Advanced course

Excel VB

I have a lot of data listed in columns. Two of these colums are 'Area' and 'Case Number'. I have created a pivot table to summarise the data whereby I now have a count of the number of case numbers broken down by area. However the count is just counting the number of rows so if the same case number is listed twice it is recorded as 2 rather than 1.

Is there anyway of counting only unique case numbers?

For upcoming training course dates see: Pricing & availability

replyReply Fri 24 Oct 2008, 13:11Trainer Amanda said...

RE: Excel VB

Hi David

Thank you for your question.

You can do this without using VBA.

Rather than creating the pivot table from your original data, first create a data list containing only unique records, then create the pivot table from the unique records.

To create a list of unique records, select the data range that you have currently. Then go to Data - Filter - Advanced filter.

Select Copy to another location under Action, then in the Copy to box, select a blank cell that will be the first cell in your list of unique records when it appears.

Tick the Unique records only box and click OK.

Then create your pivot table from the list of unique records.

I hope this helps - I don't know any VBA and we may not be able to provide a timely response to your question on how to resolve this using VBA at the moment.

Amanda

replyReply Fri 24 Oct 2008, 14:58Delegate David said...

RE: Excel VB

Thanks for the quick reply.

Sorry i think i havent really explained this very well. Basically the advanced filter will pick up the unique case numbers but it losses the area from where they are from.

For example:

Area Case Number
Gloucestershire 1234
Gloucestershire 1234
Gloucestershire 345
Dorset 678


When I use the advanced filter it will show the unique case numbers as 1234, 345 & 678 but when I put it into a pivot table it will show the count of 3 against Gloucestershire rather than what I want it to show which is:

Gloucestershire 2
Dorset 1

Regards
Dave

replyReply Mon 27 Oct 2008, 09:30Trainer Amanda said...

RE: Excel VB

Hi David

I have used the data you provided above and created the pivot table from the filtered data (attached) - it seems to give me the result you are after. Did you create the pivot table from the results of the filter, or from the original data list?

Amanda

Attached files...

adv filter and pivot.xls

 

Please browse our web site to find out more about
vba-excel-training and other Microsoft training courses.

Excel tip:

Display pictures on Chart Data Point

Replacing a single chart data point bar with a picture.
Step 1: Left click on a bar. Then, wait, and do a second single click on the bar. This will select just one data point.

Step 2: Right click on the bar and select Format Data Point.

Step 3: On the fill effects tab, choose a picture. Browse for a picture for that bar. Indicate if you want it to be stretched or stacked. Repeat for each bar.

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard