How do I Make a Drop Down with a Catch All?

Shinano

Board Regular
Joined
Dec 5, 2004
Messages
64
Office Version
  1. 365
Platform
  1. Windows
Hello all you wise men & women,

After more than a decade away from this forum - you know, Life? - I managed to make my way back in after a long time of jogging my memory about my credentials. Man, Excel has evolved over the years...

Anyway, I have question for all you great people. I am trying to make a drop down menu with a "catch all values", or whatever you want to call it. Like:

Drop down items:

1. A
2. B
3. C
4. Sum of A, B & C

For 1., 2. & 3. I am fine, I used List. But, I can not get my head around 4. I managed to come up with a solution adding: '<>""' as the fourth item in the List. That appears to work and give me the outcome that I want, but in the drop down list it looks like, well: <>"" Do we agree that does not look very slick?

I am looking for something saying:"All Values", or "Total", or something like that while at the same time catching the sum of the other values combined.

How would you go about that?

Thank you very much in advance.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
what version of excel
you could use an IF

in the list - add something like ALL

then use an IF
=IF( dropdown cell = "ALL" , SUM(Range) , SUMIF(Range , Range , dropdowncell)

for example

Filter values using a list as criteria.xlsx
ABCDNO
1a1data validation list
2b2alla
3c3b
4a4c
5c5d
6all
7
815
Sheet1
Cell Formulas
RangeFormula
D8D8=IF(D2="All",SUM(B1:B5),SUMIF(A1:A5,D2,B1:B5))
Cells with Data Validation
CellAllowCriteria
D2List=$O$2:$O$6
 

Attachments

  • Screenshot 2023-02-08 at 11.17.58.png
    Screenshot 2023-02-08 at 11.17.58.png
    178.6 KB · Views: 5
Upvote 0
You're using vba to do something with the choices or is this about a formula? If vba then add ALL to the value list and sum/concatenate all of the list choices. To concatenate it could be like this:
VBA Code:
Sub concatListItems()
Dim i As Integer
Dim str As String

For i = 0 To UserForm.ListBox2.ListCount - 1
     str = str & UserForm.ListBox2.List(i) & ", "
Next
str = Left(str, Len(str) - 2)
Debug.Print str

End Sub
 
Upvote 0

Forum statistics

Threads
1,215,094
Messages
6,123,071
Members
449,092
Latest member
ipruravindra

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