Solved

Referencing a named range in a formula

Posted on 2011-03-20
4
351 Views
Last Modified: 2012-08-14
I see that I can easily use a named range in a formula like so - =COUNTA(DPL). That formula counts all non blank cells in range DPL. However, I need the named range to be dynamic.

The formula below returns the value of DPL.

=VLOOKUP(C4,ProductList!$E$2:$G$11,3,FALSE)

When I drop the VLOOKUP formula into the COUNTA formula (below) I get the value of 1. I see why I get 1, but don't know how to get it to count values in the named range.

=COUNTA(VLOOKUP(C4,ProductList!$E$2:$G$11,3,FALSE))

I'm attaching the file in case this makes no sense at all.


2011-CAP-Trial-Data-Collection.xls
0
Comment
Question by:dlogan7
  • 2
4 Comments
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 250 total points
ID: 35176405
Hello,

if you want to pass the range name from a Vlookup result to a Counta, you need Indirect()

=COUNTA(INDIRECT(VLOOKUP(C4,ProductList!$E$2:$G$11,3,FALSE)))

the result is 40

cheers, teylyn
0
 
LVL 81

Assisted Solution

by:zorvek (Kevin Jones)
zorvek (Kevin Jones) earned 250 total points
ID: 35176473
I have set up the validation lists in the second column to changed based on what is selected in the first column. See attached.

Kevin
2011-CAP-Trial-Data-Collection.xls
0
 
LVL 81

Expert Comment

by:zorvek (Kevin Jones)
ID: 35176482
The validation list formula for "Variety" cell D4 is:

=OFFSET(INDIRECT("'ProductList'!J3"),0,MATCH(C4,INDIRECT("'ProductList'!J2:S2"),0)-1,COUNTA(OFFSET(INDIRECT("'ProductList'!J:J"),0,MATCH(C4,INDIRECT("'ProductList'!J2:S2"),0)-1))-1,1)

Once entered the formatting can be copied down to the remaining cells in that column.

Kevin
0
 

Author Closing Comment

by:dlogan7
ID: 35176562
Thanks to both of you for the top notch help. Now the only thing I have to worry about is someone changing the brand after they have already selected the product.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question