# Use a function on a indirect range

I use this formula : =SUM.IF(INDIRECT("'"&\$A4&"'!C:C");"D";INDIRECT("'"&\$A4&"'!D:D"))
Now in fact I want the sum argument to be the absolute value so, something like this ABS(INDIRECT("'"&\$A4&"'!D:D"))
I suspect this is possible as this remembers me something similar (but I don't remember where I saw it)
Thanks
LVL 1
Asked:
###### Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Try this...

=SUMIF(INDIRECT("'" & ABS(\$A4) & "'!C:C"); "D"; INDIRECT("'" & ABS(\$A4) & "'!D:D"))
Commented:
Is this somehow related to PHP?
Author Commented:
No, not PHP
Wayne, not ABS(\$A4)
The referenced range contains positive and negative value (in the other sheet)
I want the sum of ABS values
The ABS must be applied to the values, not the references
EngineerCommented:
Try

=SUMPRODUCT((INDIRECT("'"&\$A4&"'!C:C")="D")*ABS(INDIRECT("'"&\$A4&"'!D:D")))
Commented:
You can't apply functions in the sum range with SUMIF. You could either use 2 SUMIFS and subtract the negative result:

=SUMIFS(INDIRECT("'"&\$A4&"'!D:D"),INDIRECT("'"&\$A4&"'!C:C");"D";INDIRECT("'"&\$A4&"'!D:D"),">0")-=SUMIFS(INDIRECT("'"&\$A4&"'!D:D"),INDIRECT("'"&\$A4&"'!C:C");"D";INDIRECT("'"&\$A4&"'!D:D"),"<0")

or use a SUMPRODUCT:
=SUMPRODUCT((INDIRECT("'"&\$A4&"'!C:C")="D")*(ABS(INDIRECT("'"&\$A4&"'!D:D"))))
Author Commented:
Well, now I get #VALUE! as result
Commented:
With which formula? If it's the SUMPRODUCT one, you probably have text values in at least one of the data rows. Change the ranges to not include header rows and any other text rows, if you can.
Author Commented:
Can you provide a small Excel example ?
I have the french version ... will be easier (automatic translation of formula)
My current formula (without ABS) and working fine (some non numeric cells present) was :
=SOMME.SI(INDIRECT("'"&\$A4&"'!C:C");"D";INDIRECT("'"&\$A4&"'!D:D"))
Commented:
Try this one.
SUMIFS-ABS.xlsx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Exactly what I need !
Many thanks
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.