I am using the following formula:
=SUMIF('01-03'!$A:$A,"05",'01-03'!$I:$I)
I want to replace the '01-03' (worksheet name) to TEXT($A15,"dd-mm"), so that I can drag the formula down.
.. but can't get the syntax correct. How can I put this together?
SumIf from various worksheets
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
SumIf from various worksheets
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SumIf from various worksheets
Try this:
=SUMIF(INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$A:$A"),"05",INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$I:$I"))
Note the use of single quotes around the sheet name.
=SUMIF(INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$A:$A"),"05",INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$I:$I"))
Note the use of single quotes around the sheet name.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: SumIf from various worksheets
Thanks, now another dull question: How to add in ISERROR?
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SumIf from various worksheets
The general "recipe" to suppress errors in a formula of the form
=P
is to use
=IF(ISERROR(P),"",P)
or in Excel 2007 and higher
=IFERROR(P,"")
These formulas will return a blank string if the original formula results in an error. You can replace "" with another value, e.g. 0. So in your example
=IF(ISERROR(SUMIF(INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$A:$A"),"05",INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$I:$I"))),"",SUMIF(INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$A:$A"),"05",INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$I:$I")))
It looks intimidating, but it's just the "recipe" applied to a longish formula...
=P
is to use
=IF(ISERROR(P),"",P)
or in Excel 2007 and higher
=IFERROR(P,"")
These formulas will return a blank string if the original formula results in an error. You can replace "" with another value, e.g. 0. So in your example
=IF(ISERROR(SUMIF(INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$A:$A"),"05",INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$I:$I"))),"",SUMIF(INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$A:$A"),"05",INDIRECT("'"&TEXT($A15,"dd-mm")&"'!$I:$I")))
It looks intimidating, but it's just the "recipe" applied to a longish formula...
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.
Re: SumIf from various worksheets
Thankyou!
I seem to be surrounded by intimidating formula's these days.
What I find odd about this (using "0" for the ISERROR) is that the 0 is left aligned, not right aligned. Why is that?
I seem to be surrounded by intimidating formula's these days.
What I find odd about this (using "0" for the ISERROR) is that the 0 is left aligned, not right aligned. Why is that?
Nathan
There's no place like home.....
There's no place like home.....
-
- Administrator
- Posts: 78596
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SumIf from various worksheets
If you use "0", the result is a text string and hence left-aligned. If you use 0 (without the quotes), the result is a number and hence right-aligned.
Of course, you can override the default alignment if you wish.
Of course, you can override the default alignment if you wish.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1185
- Joined: 24 Jan 2010, 12:02
- Location: Wales, UK.