Link to home
Start Free TrialLog in
Avatar of LeTay
LeTay

asked on

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
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Try this...

=SUMIF(INDIRECT("'" & ABS($A4) & "'!C:C"); "D"; INDIRECT("'" & ABS($A4) & "'!D:D"))
Is this somehow related to PHP?
Avatar of LeTay
LeTay

ASKER

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
Try

=SUMPRODUCT((INDIRECT("'"&$A4&"'!C:C")="D")*ABS(INDIRECT("'"&$A4&"'!D:D")))
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"))))
Avatar of LeTay

ASKER

Well, now I get #VALUE! as result
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.
Avatar of LeTay

ASKER

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"))
ASKER CERTIFIED SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeTay

ASKER

Exactly what I need !
Many thanks