Array constant to refer to a range

tiredofit

Well-known Member
Joined
Apr 11, 2013
Messages
1,404
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:

Some videos you may like

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,549
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=SUM(SUMIFS(B:B,A:A,D2:D3))
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,549
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

You're welcome.
 

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,629
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
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
 

Watch MrExcel Video

Forum statistics

Threads
1,127,581
Messages
5,625,611
Members
416,124
Latest member
DeMoNloK

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
Top