Dynamic 'Defined Name' values within a formula not providing expected results

grigby21

New Member
Joined
Aug 28, 2018
Messages
13
Have a formula:
=SUMPRODUCT(COUNTIFS( INDIRECT("'"&$A$2&"'!$H$3:$H$99955"), $A$2 & UAT, INDIRECT("'"&$A$2&"'!$G$3:$G$99955"), $A$2 & Defect))

WHERE $A$2 refers to a dynamic value which serves as a prefix in the Defined Name naming convention.

Results being returned are not in agreement with the static search criteria.

Thoughts?

Thanks!
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
What is the value in A2 and what is it supposed to refer to?

What should $A$2 & Defect refer to?
 
Upvote 0
INDIRECT("'"&$A$2&"'!$H$3:$H$99955")

implies that you have a sheet whose name equals the value in A2. Is that the case?
 
Upvote 0
That is correct, and that is working properly. It's the reference to the Defined Name which is not working.

Thus we have A2 = con and A2&"Defect" which is a defined name. If so, and the same holds for A2&"UAT", then we should have:

=SUMPRODUCT(COUNTIFS( INDIRECT("'"&$A$2&"'!$H$3:$H$99955"), INDIRECT($A$2 & "UAT"), INDIRECT("'"&$A$2&"'!$G$3:$G$99955"), INDIRECT($A$2 & "Defect"))

where the contents of the defined names are used as conditions.


Is this your intent?
 
Upvote 0
Thus we have A2 = con and A2&"Defect" which is a defined name. If so, and the same holds for A2&"UAT", then we should have:

=SUMPRODUCT(COUNTIFS( INDIRECT("'"&$A$2&"'!$H$3:$H$99955"), INDIRECT($A$2 & "UAT"), INDIRECT("'"&$A$2&"'!$G$3:$G$99955"), INDIRECT($A$2 & "Defect"))

where the contents of the defined names are used as conditions.


Is this your intent?

Exactly!
 
Upvote 0
...however the approach noted, doesn't provide the expected results.

It was an attempt at intention reading...

Note that

INDIRECT($A$2 & "UAT")

must be a named range, that is, conUAT which stands for a range housing items that must hold for con!$H$3:$H$99955

and that

INDIRECT($A$2 & "Defect")

must be a named range, that is, conDefect which stands for a range housing items that must hold for con!$G$3:$G$99955.

If this re-construction does not reflect the situation you are in, you need to elaborate.
 
Upvote 0
It was an attempt at intention reading...

Note that

INDIRECT($A$2 & "UAT")

must be a named range, that is, conUAT which stands for a range housing items that must hold for con!$H$3:$H$99955

and that

INDIRECT($A$2 & "Defect")

must be a named range, that is, conDefect which stands for a range housing items that must hold for con!$G$3:$G$99955.

If this re-construction does not reflect the situation you are in, you need to elaborate.


Thanks. I do have Defined Names created for conUAT, and conDefect... and when they are entered directly into the formula, it works fine. When I try to add the concatenated value, it is seemingly not recognized as a Defined Name.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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