Count unique values upon three criteria

premvinoth

New Member
Joined
Aug 4, 2015
Messages
16
Hi,

I have about 1,500 rows of data as mentioned below. Everyday I would need to prepare a report for the previous 3 days. (That file contains only previous 3 days data). For each date, for each of the dealer, i need to count the product and generate a report as shown at the bottom...
[TABLE="class: outer_border, width: 500, align: left"]
<tbody>[TR]
[TD]Date[/TD]
[TD]Dealer[/TD]
[TD]Product[/TD]
[/TR]
[TR]
[TD]08/03/2015[/TD]
[TD]Dealer A[/TD]
[TD]Mobile phone[/TD]
[/TR]
[TR]
[TD]08/03/2015[/TD]
[TD]Dealer A[/TD]
[TD]Watch[/TD]
[/TR]
[TR]
[TD]08/03/2015[/TD]
[TD]Dealer A [/TD]
[TD]Mobile Phone[/TD]
[/TR]
[TR]
[TD]08/03/2015[/TD]
[TD]Dealer A[/TD]
[TD]Laptop[/TD]
[/TR]
[TR]
[TD]08/03/2015[/TD]
[TD]Dealer A[/TD]
[TD]Laptop[/TD]
[/TR]
[TR]
[TD]08/03/2015[/TD]
[TD]Dealer A[/TD]
[TD]Mobile Phone[/TD]
[/TR]
[TR]
[TD]08/02/2015[/TD]
[TD]Dealer A[/TD]
[TD]Laptop [/TD]
[/TR]
[TR]
[TD]08/02/2015[/TD]
[TD]Dealer A[/TD]
[TD]Watch[/TD]
[/TR]
[TR]
[TD]08/02/2015[/TD]
[TD]Dealer A[/TD]
[TD]Watch[/TD]
[/TR]
[TR]
[TD]08/01/2015[/TD]
[TD]Dealer A[/TD]
[TD]Mobile phone[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="class: grid, width: 800"]
<tbody>[TR]
[TD]Dealer[/TD]
[TD]Dealer total count[/TD]
[TD]Day1 count[/TD]
[TD]Day1 product wise count[/TD]
[TD]Day2 count[/TD]
[TD]Day2 product wise count[/TD]
[TD]Day3 count[/TD]
[TD]Day3 product wise count[/TD]
[/TR]
[TR]
[TD]Dealer A[/TD]
[TD]10[/TD]
[TD]6[/TD]
[TD]3-Mobile phone, 2-Laptop, 1-Watch[/TD]
[TD]3[/TD]
[TD]2-Watch, 1-Laptop[/TD]
[TD]1[/TD]
[TD]1-Mobile phone[/TD]
[/TR]
</tbody>[/TABLE]

The product wise count needs to be in a descending order based on the count. Show here is sample data for one dealer (Dealer A), there are 10 dealers in the dataset, and this similar report needs to be generated in a single sheet.

I would highly appreciate your support in automating it in VBA. Thank you in advance.

Regards,
Vinoth
 
NB:- The above code is based on Data in "sheet4", change as required , at top of code !!!!
 
Upvote 0

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