Distinct Count within Report

andthe

New Member
Joined
Sep 26, 2003
Messages
25
I have a report with 2 groups: PART and VENDOR. An example of the output is belows:

PART VENDOR PO
abc target a12345
abc target a32343
abc kmart b23433
def walmrt c23433

Using the example above, I would expect to see a vendor total of 2 for part ABC and a vendor total of 1 for part DEF. This sounds easy, but I cannot determine how to perform the calculation within the report. Any help is greatly appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Are you actually using Groups in your report? If so, you should be able to use the Group Footer to calculate totals for that specific group. Simply insert a text box and in the Control Source enter:

=COUNT([FieldName]) to get the count and
=SUM(FieldName]) to get sthe sum of each group.

If you want a Grand Total of all groups, simply enter these expressions in Text Boxes in the Report Footer.
 
Upvote 0
Yes, I'm am using Groups. I verified this by going to View --> Sorting and Grouping and I see a symbol next to both of those fields. I attempted to use the count formula, but I instead of getting of a total of 2 vendors for part ABC I'm getting 3. It's counting each record it finds within that group - not the unique records. Am I missing something? Thanks!
 
Upvote 0
I would createanother query to count the distinct number of Vendors for each part.

Simply do a query where you add the Part field, then the Vendor field twice. Then clicking on the Totals button, so that "Group By" appears under each field. On the second Vendors field, change the "Group By" to "Count".

Then link this query into your main query the report is running off of, and you will have access to the count you need.

There may be a better way to do it, i.e. in a calculation in the report, but I am unsure how to do it.
 
Upvote 0

Forum statistics

Threads
1,221,783
Messages
6,161,913
Members
451,730
Latest member
BudgetGirl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top