### excel

#### Convert sumproduct formula into a generic formula that can be used across all sheets in a workbook

```I have this formula where I want to convert it into a generic formula that reference to a sheet name in a cell
Current formula as below:
=SUMPRODUCT(('Data-2017'!W1:EZ1="Enemy 1")*('Data-2017'!W3:EZ1361="Yes")*('Data-2017'!J3:J1361=\$T\$4))
Where Data-2017 is the sheet name.
I have tried converting to following but failed:
=SUMPRODUCT(--(INDIRECT("'" & \$D\$3 & "'!" & "W1:EZ1=" & CHAR(34) & "Enemy 1" & CHAR(34))*("'" & \$D\$3 & "'!" & "W3:EZ1361=" & CHAR(34) & "Enemy 1" & CHAR(34))*("'" & \$D\$3 & "'!" & "J3:J1361=" & T4))
where D3 is the cell for sheet name, T4 is another value in to suffice the condition
```
```INDIRECT only goes around the cell references not the whole formula:
=SUMPRODUCT((INDIRECT("'" & \$D\$3 & "'!" & "W1:EZ1")="Enemy 1")*(INDIRECT("'" & \$D\$3 & "'!" & "W3:EZ1361")="Yes")*(INDIRECT("'" & \$D\$3 & "'!" & "J3:J1361")=\$T\$4))
```
```I actually figured out by accident after further research, hope this will help others in the future:
=SUMPRODUCT((INDIRECT("'"&\$D\$3&"'!\$W\$1:\$EZ\$1")="Enemy 1")(INDIRECT("'"&\$D\$3&"'!\$W\$3:\$EZ\$1500")="Yes")(INDIRECT("'"&\$D\$3&"'!\$J\$3:\$J\$1500")=T\$4))
Cheers```

Encrypt Message

code
soft
python
ios
c
html
jquery
cloud
mobile