# Array constant to refer to a range

#### tiredofit

##### Well-known Member
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"})))``

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

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

#### Fluff

##### MrExcel MVP, Moderator
Excel Formula:
``=SUM(SUMIFS(B:B,A:A,D2:D3))``

#### tiredofit

##### Well-known Member
Excel Formula:
``=SUM(SUMIFS(B:B,A:A,D2:D3))``

Thanks but it didn't work for me.

Sorry, I forgot to enter it as an array.

It did work, see later post!

You're welcome.

#### Dave Patton

##### Well-known Member
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

#### tiredofit

##### Well-known Member
Some alternatives to consider

T202009b.xlsm
ABCD
1119841
2217842
321584
421384
511184
619
737
845
943
2b
Cell Formulas
RangeFormula
B2:B9B2=B1-2

Great, thanks for the choices.

Replies
1
Views
34
Replies
0
Views
92
Replies
12
Views
287
Replies
7
Views
88
Replies
27
Views
607

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.

### Which adblocker are you using?

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

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