Solved

Referencing a named range in a formula

Posted on 2011-03-20
4
346 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:
teylyn 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now