Array constant to refer to a range

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,825
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
I have two columns of data in columns A and B.

Column A consists of 1s and 2s, column B random numbers.

In cell F6, I have this formula:

Code:
=(SUM(SUMIFS(B:B,A:A,{"1","2"})))

1600194531932.png

How can I make this part of the formula:

Code:
{"1", "2"}

refer to a range of cells?

For example, if I want to change the criteria to 5 and 6, obviously I can change it in the formula itself but instead I would like to change it in some other cell.

Thanks
 
Last edited:

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
How about
Excel Formula:
=SUM(SUMIFS(B:B,A:A,D2:D3))
 
Upvote 0
Some alternatives to consider

T202009b.xlsm
ABCD
1119841
2217842
321584
421384
511184
619
737
845
943
2b
Cell Formulas
RangeFormula
C1C1=SUM(SUMIFS(B:B,A:A,{"1","2"}))
C2C2=SUM(SUMIFS(B:B,A:A,{1,2}))
C3C3=SUMPRODUCT(--((A1:A9=D1)+(A1:A9=D2)),B1:B9)
C4C4=SUMPRODUCT(--(ISNUMBER(MATCH(A1:A9,D1:D2,0))),B1:B9)
C5C5=SUMPRODUCT(SUMIFS(B:B,A:A,D1:D2))
B2:B9B2=B1-2
 
Upvote 0

Forum statistics

Threads
1,213,550
Messages
6,114,265
Members
448,558
Latest member
aivin

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