whats wrong with my formula?

colinheslop1984

Board Regular
Joined
Oct 14, 2016
Messages
102
Hi

need help completing a SUMIFS(INDIRECT function that will gather data from another workbook. I am trying the below formula but it I get a message saying theres an error, but I'm not that great at this sort of stuff.

=SUMIFS('[WEEKLY SALES PERFORMANCE.xlsx]'INDIRECT("'"!$H:$H),'[WEEKLY SALES PERFORMANCE.xlsx]'INDIRECT("'"!$B:$B,$O$1),'[WEEKLY SALES PERFORMANCE.xlsx]'INDIRECT("'"!$C:$C,"<="&$K$1))

Can someone correct me please
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,923
Office Version
365, 2019, 2016
Platform
Windows
see if this work? note that the WEEKLY SALES PERFORMANCE.xlsx needed to be open for the indirect() to work

Code:
=SUMIFS(INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"&$H:$H),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"&$B:$B,$O$1),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"&$C:$C,"<="&$K$1))
 

colinheslop1984

Board Regular
Joined
Oct 14, 2016
Messages
102
Sorry I missed something off...

=SUMIFS(INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"'"c1"&$H:$H),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"'"c1"&$B:$B,$O$1),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"'"c1"&$C:$C,"<="&$K$1))

c1 contains the year to look up, this is to find the desired worksheet name from the weekly sale performance workbook.

I want to SUM H:H where b:b = o1 and where c:c <=k1
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,923
Office Version
365, 2019, 2016
Platform
Windows
try

Code:
=SUMIFS(INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!C1"&$H:$H),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!C1"&$B:$B,$O$1),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!C1"&$C:$C,"<="&$K$1))
 

colinheslop1984

Board Regular
Joined
Oct 14, 2016
Messages
102
it just seems to be referencing the current sheet for h:h, c:c, b:b, rather than the weekly sales sheet

Is there another way maybe to perform the same calculation?
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,923
Office Version
365, 2019, 2016
Platform
Windows
Sorry I missed something off...

=SUMIFS(INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"'"c1"&$H:$H),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"'"c1"&$B:$B,$O$1),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!"'"c1"&$C:$C,"<="&$K$1))

c1 contains the year to look up, this is to find the desired worksheet name from the weekly sale performance workbook.

I want to SUM H:H where b:b = o1 and where c:c <=k1
try this

Code:
=SUMIFS(INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]"&C1&"'!$H:$H"),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]"&C1&"'!$B:$B"),"=o1",INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]"&C1&"'!$C:$C"),"<="&K1)
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,923
Office Version
365, 2019, 2016
Platform
Windows
you're welcome
 

AlanY

Well-known Member
Joined
Oct 30, 2014
Messages
3,923
Office Version
365, 2019, 2016
Platform
Windows
try

Code:
=SUMIFS(INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!C1"&$H:$H),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!C1"&$B:$B,$O$1),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]'!C1"&$C:$C,"<="&$K$1))
just noticed that O1 is a cell reference, formula should be

Code:
=SUMIFS(INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]"&C1&"'!$H:$H"),INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]"&C1&"'!$B:$B"),[COLOR="#FF0000"]$O$1[/COLOR],INDIRECT("'[WEEKLY SALES PERFORMANCE.xlsx]"&C1&"'!$C:$C"),"<="&$K$1)
 
Last edited:

Forum statistics

Threads
1,081,574
Messages
5,359,707
Members
400,545
Latest member
Damntheman30

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top