List with sorted totals

redridinghood74

New Member
Joined
Jul 28, 2017
Messages
14
I have a "TAKINGS" Worksheet with the table "TAKINGS", it has 8 column headers;
DATE, STAFF, QTY, DESCRIPTION, SIZE, TOTAL, DEPT, EFTPOS.
With contents like;

30/07/2017, Neil, 1, WESTEND, PINT, 7, ONTAP, Y
30/07/2017, Neil, 1, XXXX, PINT, 7, ONTAP, Y
30/07/2017, Neil, 1, PALEALE, PINT, 7, ONTAP, N
30/07/2017, Neil, 1, PALEALE, PINT, 7, ONTAP, N
30/07/2017, Neil, 1, XXXX, PINT, 7, ONTAP, N
30/07/2017, Neil, 1, XXXX, PINT, 7, ONTAP, Y

I would like to choose a month &/ season, and see on a userform as a list of items from
a particular "DEPT" including summed totals ordered per item with the highest seller first.

i.e.Combobox = Month
WESTEND $12,000
XXXX $9,000
PALEALE $2,000

The takings sheet starts in July 2017 & ends in June 2018, a new workbook every year.

It has been 20 years since i last used vb :(

My assumption is, Where DEPT = .ONTAP & Month([DATE]) = cboMonth do
Where DESCRIPTION is unique then SUMIF
ListBox "DESCRIPTION" "TOTAL" SORT

I don't remember.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Bill Jelen wrote;
The Power Excel book has no VBA. For VBA, I recommend either
Amazon.com: Excel 2016 VBA and Macros (includes Content Update Program) (MrExcel Library) (9780789755858): Bill Jelen, Tracy Syrstad: Books

or
the 2500 CD


Here are some tips for your posts, based on your two posts at my site:

You need to start with an introductory 2 sentences telling us what you are trying to do and why the code you have now is not working.


Some people reading the board are smart enough to look at your code (with zero comment lines) and figure out what you think it should be doing.
But that would take me ten minutes and your two sentences would get me up to speed in 30 seconds.
People need to know if they can help you or not, long before they spend 10 minutes just to figure out what you are trying to do.


Something along the lines of:
I have a spreadsheet with dates in column A & column C. I am using VBA to test if each date in C is found in column A. The code below is failing because is says that July 1 is the same as August 1 and clearly it is not. I've added some comments to the code where I think the problem may be happening. Thanks in advance for any help.

Books purchased 2
Replies 0

:(
 
Upvote 0
FWIW, your dearth of responses is undoubtedly because you're not adhering to Bill's advice. You have not posted the actual code you've written. Only a rather vague description of the objectives. You're saying you'd like to see "summed totals ordered per item" in a userform. I'm not quite sure why or if this is a good use of a userform. But let's pretend that it is a good design decision. You still haven't told us whether you're trying to put this in a multicolumn ListBox control or a textbox control or an embedded worksheet control. You do have a numeric field [your sixth, TOTAL] in your data, but you do not specify if this is the field summed.

Overall, just based on your description of what you appear to be doing -- it sounds like you'd be better off looking at a pivot table on a spreadsheet instead of a userform and VBA. You could use a slicer or a filter field to make your month/season selections.

Good luck,
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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