The "Or" operator

sherifhanna82

New Member
Joined
Feb 26, 2011
Messages
4
Hello everyone,

I am trying to use the Count & Sum if functions, if the criteria range contains one or more value from a set of strings.

Example:

I want to sum the numbers in the A column, if the any of the cells in the B column contain X or Y or Z. So, it would look something like this:

=sumif(B:B,"x" ? "y" ? "z",A:A). I want the formula to return the sum of the cells adjacent to those who have X, Y, or Z, but not necessarily all of them together. The ? sign indicates the operator/sign I am missing.

Thanks for your input.

Sherif.
 
Last edited:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hello everyone,

I am trying to use the Count & Sum if functions, if the criteria range contains one or more value from a set of strings.

Example:

I want to sum the numbers in the A column, if the any of the cells in the B column contain X or Y or Z. So, it would look something like this:

=sumif(B:B,"x" ? "y" ? "z",A:A). I want the formula to return the sum of the cells adjacent to those who have X, Y, or Z, but not necessarily all of them together. The ? sign indicates the operator/sign I am missing.

Thanks for your input.

Sherif.
Try...

=SUM(SUMIF(B:B,{"x","y","z"},A:A))

If you would enter x, y, and z in say E2:E4...

=SUMPRODUCT(SUMIF(B:B,E2:E4,A:A))
 
Upvote 0
but not necessarily all of them together.

If a cell in column B could have any combination of X, Y and\or Z, but you only want to sum the corresponding value in A once, then try something like this...
Excel Workbook
ABC
11x20
22
33
44xy
55
66
77xz
88yz
99
1010
Sheet
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,609
Messages
6,179,881
Members
452,948
Latest member
Dupuhini

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