ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Using SUM, ADDRESS, INDIRECT in an array not working (https://www.excelbanter.com/excel-worksheet-functions/183870-using-sum-address-indirect-array-not-working.html)

Bradley

Using SUM, ADDRESS, INDIRECT in an array not working
 
Hi,

Here's the problem (I simplified the formula a little to make it easier to
understand.)

=SUM(IF(AreaLookup_RD=1,INDIRECT("Area"&AreaLookup &"!B16"),0))

I am trying to add values in different worksheets if they are assigned to an
area #. I want the values in:

Area1!B16 (assigned to Region 1)
Area2!B16 (assigned to Region 1)
Area3!B16 (assigned to Region 2)
Area4!B16 (assigned to Region 2)
Area5!B16 (assigned to Region 3)
Area6!B16 (assigned to Region 3)
Area7!B16 (assigned to Region 3)

So I have a lookup table:

Column 1 = Region #
Column 2 = Area #

The formula above uses the lookup table to figure out which Area #'s to sum
up.

For some reason Excel is only doing the Array on the first worksheet and not
doing the Array in the INDIRECT function. So it basically adds up a bunch of
Area1!B16 instead of using the correct Area # to go to the right worksheet


I also tried rewriting it to:
=SUM(IF(Lookup!$I2:$I$30=1,"=INDIRECT("&ADDRESS(16 ,2,1,TRUE,"Area"&Lookup!$J$2:$J$30)&")",0))
- and -
=SUM(IF(Lookup!$I2:$I$30=1,ADDRESS(16,2,1,TRUE,"Ar ea"&Lookup!$J$2:$J$30),0))

Any help would be greatly appreciated!

Thanks,
Bradley


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com