Indirect, SumProduct and Errors

fluffynicesheep

Board Regular
Joined
Oct 27, 2009
Messages
69
Hi all,

I am currently using sumproduct to find out numbers in a particular column in a 2nd spreadsheet.

This formula works fine in column B:

=SUMPRODUCT(('Y:\National Careers Service - Mail Merge\Brentwood\[Brentwood.xlsm]a_Main'!$AR$1:$AR$10000=B4)+0,('Y:\National Careers Service - Mail Merge\Brentwood\[Brentwood.xlsm]a_Main'!$HL$1:$HL$10000>='Overview - CSO'!$B$5)+0,('Y:\National Careers Service - Mail Merge\Brentwood\[Brentwood.xlsm]a_Main'!$HL$1:$HL$10000<='Overview - CSO'!$B$9)+0)


However, I then have to redo this for Bromley, Chippenham etc - very time consuming!!

The town names are in column A, and I was hoping to automate this as much as possible using the Indirect function. - so the above would be linked to A1, then in the row down it would be linked to the town in A2 etc..

Even better would be if I could also add the =IFERROR function to return a 0 if the required worksheet wasn't found.

If you could point me in the right direction that would be great.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Try:

=SUMPRODUCT((INDIRECT("'Y:\National Careers Service - Mail Merge" & A1 & "\[" & A1 & ".xlsm]a_Main'!$AR$1:$AR$10000")=B4)+0,(INDIRECT("'Y:\National Careers Service - Mail Merge" & A1 & "\[" & A1 & ".xlsm]a_Main'!$HL$1:$HL$10000")>='Overview - CSO'!$B$5)+0,(INDIRECT("'Y:\National Careers Service - Mail Merge" & A1 & "\[" & A1 & ".xlsm]a_Main'!$HL$1:$HL$10000")<='Overview - CSO'!$B$9)+0)

Note:
If you use INDIRECT to refer to external workbooks then they have to be open or else INDIRECT won’t work.
 
Upvote 0
Many thanks Dante Amor

That could be an issue then having to open multiple workbooks. Is there any way to do the same thing with the workbooks closed?
 
Upvote 0
The result is on your sheet, if the books are closed and you recalculate your sheet, then the #Ref error will appear
 
Upvote 0
Another option would be to remove the formulas and update the values ​​with VBA, press a button or an event to update the values ​​in the sheet.
 
Upvote 0

Forum statistics

Threads
1,214,574
Messages
6,120,329
Members
448,956
Latest member
Adamsxl

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
Back
Top