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!
 
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.

Before proceeding further...

Control+shift+enter, not just enter:

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

Does this work as you expect?
 
Upvote 0

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Before proceeding further...

Control+shift+enter, not just enter:

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

Does this work as you expect?

Thanks.... ...unfortunately, no.
 
Upvote 0
What do those UAT and Defect range names refer to? You may be having problems with implicit intersection not working whan using INDIRECT and hence the INDIRECT returning the entire array rather than the intersection between the current row (of the formula) with the array the range name points to.
 
Upvote 0
What do those UAT and Defect range names refer to? You may be having problems with implicit intersection not working whan using INDIRECT and hence the INDIRECT returning the entire array rather than the intersection between the current row (of the formula) with the array the range name points to.

They, combined with the $A$2 value refers to Defined Names. In my estimation, it seems the concatenated value is not being treated as a Defined Name, rather a literal text value.
 
Upvote 0
Thanks.... ...unfortunately, no.

No, meaning wrong count or error?

And, care to post the contents of conUAT and conDefect?

Here is a workout...


Book1
ABCGHIJKL
1conUATconDefect
2con4qadaakad
3vadablad
4kadbcnad
5kadcvad
6lada
7qadd
8lade
9ladd
10
11
con


conUAT is a named range, referring to K2:K4 and conDefect a named range referring to L2:L5.

A2 = con

In B2 control+shift+enter, not just enter:

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

Is the foregoing analogical/comparable to your situation?
 
Upvote 0
No, meaning wrong count or error?

And, care to post the contents of conUAT and conDefect?

Here is a workout...

ABCGHIJKL
1conUATconDefect
2con4qadaakad
3vadablad
4kadbcnad
5kadcvad
6lada
7qadd
8lade
9ladd
10
11

<colgroup><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
con

conUAT is a named range, referring to K2:K4 and conDefect a named range referring to L2:L5.

A2 = con

In B2 control+shift+enter, not just enter:

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

Is the foregoing analogical/comparable to your situation?

Yes this is very similar to my current situation. However I am presently getting a count of 0. If I change the calls of the Defined Names to their actual name (conUAT, conDefect), counts are returned.
 
Upvote 0
Yes this is very similar to my current situation. However I am presently getting a count of 0. If I change the calls of the Defined Names to their actual name (conUAT, conDefect), counts are returned.

As I tried to demonstrate, INDIRECT(A2&"UAT") will return the contents of conUAT where A2 = con to the formula it's part of...

By the way, control+shift+enter means: Press down the control and the shift keys at the same while you hit the enter key. If done successfully, Excel itself puts a pair of { and } around the formula in recognition.
 
Upvote 0
As I tried to demonstrate, INDIRECT(A2&"UAT") will return the contents of conUAT where A2 = con to the formula it's part of...

By the way, control+shift+enter means: Press down the control and the shift keys at the same while you hit the enter key. If done successfully, Excel itself puts a pair of { and } around the formula in recognition.

I'll try again; however when attempting the same as noted above I was not receiving any count.
 
Upvote 0

Thanks! ...though unable to access for some reason. What I did learn, is that it seems the definition of my Defined Names is not being handled properly. When I changed the 'Refers To' from: =OFFSET('Mapping - Defects'!$O$7,0,0,COUNTA('Mapping - Defects'!$O$7:'Mapping - Defects'!$O$23),1) to an explicit definition: ='Mapping - Defects'!$O$7:$O$13 ...the formula worked. Sigh.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,678
Members
449,116
Latest member
HypnoFant

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