Solved

Referencing a named range in a formula

Posted on 2011-03-20
4
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
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!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

730 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