# INDIRECT function works with COUNTIF but not with SUMPRODUCT

#### Mariner

##### New Member

Hi,

I'm trying to use the indirect function to link to branch tabs throughout my file.
Count column = +COUNTIF(INDIRECT("'"&\$A8&"'!\$C\$6:\$C\$400"),\$C\$4)/5. This works for each branch (35, 12, 9, and so on).

Hours column = +SUMPRODUCT(--(Houston!\$C\$6:\$C\$400=\$C\$4),--(Houston!\$F\$6:\$F\$400=D\$5),Houston!\$BG\$6:\$BG\$400). That works fine for Houston (I have that copied down for the Hours column for now; that's why the number is the same for each branch).

I want to change the hours column formula so that I can copy it down without changing the branch name every time so I used:
+SUMPRODUCT(--(INDIRECT("'"&\$A8&"'!\$C\$6:\$C\$400)=\$C\$4),--(Houston!\$F\$6:\$F\$400=D\$5),Houston!\$BG\$6:\$BG\$400) just on the first leg of the formula and I get the pop up box with "There's a problem with this formula..."

Can SUMPRODUCT and INDIRECT work together? If so, what is the fix? Thanks in advance!

#### Attachments

• 1606339888665.png
5.2 KB · Views: 1

### Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

#### Fluff

##### MrExcel MVP, Moderator
You're missing the closing quotes at the end of the range in the indirect function.

#### Mariner

##### New Member
Great catch. It works. Eureka! TY!

#### Fluff

##### MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

Replies
7
Views
416
Replies
39
Views
686
Replies
10
Views
611
Replies
2
Views
157
Replies
1
Views
180

1,128,129
Messages
5,628,869
Members
416,347
Latest member
AT2021

### 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