Multiple OR criteria in argument

Frankenstein

New Member
Joined
Feb 15, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hello everyone,

Hoping someone can make quick work of this. I have a list of Manager titles and a list of Director titles. I'd like to search a database on a separate sheet and calculate two sums. One for all "manager titles" and one for all "Director" titles.

Typically i'd use a pivot table or the formula: =sum(sumif(Sheet2!B3:B15, {"Sales Manager", "Shipping Manager", "..."}, Sheet2!C3:C15) and call it a day. I have 2 problems with this:
  1. My data is not tabular
  2. My list of manager titles is much longer than this
  3. I plan to use this formula in 10-20 cells, which if I ever need to add or remove criteria will be a huge PITA so I want all formulas to reference one list of titles.
1708032901444.png


A few things i have tried to give you an idea of my goal:
  1. I changed D2 to {"Sales Manager", "Shipping Manager", "Human Resources Mgr", "Finance Mgr"} and then used: =sum(sumif(Sheet2!B3:B15, indirect(D2), Sheet2!C3:C15) and tried =sum(sumif(Sheet2!B3:B15, D2, Sheet2!C3:C15)
  2. Changed D2 to "Sales Manager", "Shipping Manager", Human Resources Mgr", "Finance Mgr" and then used concatenation: =sum(sumif(Sheet2!B3:B15, "{"&D2&"}", Sheet2!C3:C15)
Thanks everyone!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi and welcome to MrExcel.

Try:

Excel Formula:
=SUM(SUMIF(Sheet2!B3:B15,{"Sales Manager","Shipping Manager","Human Resources Mgr","Finance Mgr"},Sheet2!C3:C15))

Or:
Excel Formula:
=SUM(IF(Sheet2!B3:B15=TRIM(TEXTSPLIT(Sheet1!D2,",")),Sheet2!C3:C15,0))

🤗
 
Upvote 0
Try this, maybe:
I have the data on same sheet, but cut and paste it to another workbook and it will work.
I suggest doing this in a fresh workbook first, so you can understand the concept before moving it into your work.

Book1
ABCDEFG
1
2ManagerSales Manager, Shipping Manager, Human Resources Manager, Finance Manager
3DirectorSenior Director, Admin Director, Assoc Director
4
5
6Sales Manager10
7Shipping Manager10
8Human Resources Manager27
9Finance Manager22
10Senior Director22
11Admin Director22
12Assoc Director33
13
14
15
16
17
18Sales Manager10
19Shipping Manager10
20Human Resources Manager14
21Finance Manager11
22Senior Director11
23Admin Director12
24Assoc Director10
25Human Resources Manager13
26Finance Manager11
27Senior Director11
28Admin Director10
29Assoc Director13
30Assoc Director10
31
Sheet6
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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