Microsoft Office Forums


Reply
Thread Tools Display Modes

use cell reference for named range

 
 
elf21
Guest
Posts: n/a

 
      02-17-2006, 01:21 AM

I have named several ranges on my sheet with names of cities such a
"newYork", "Chicago", "sanDiego" etc.

I would like to use these ranges in a formula, but rather than type i
these ranges I would like to use a cell reference that contains thes
names.

For example, instead of typing =COUNT(Chicago) where "Chicago" is
range I have defined, I would like to be able to type something lik
=COUNT(A20) where A20 contains the text Chicago.

I hope I am making myself clear.
Thank you

--
elf2
-----------------------------------------------------------------------
elf21's Profile: http://www.excelforum.com/member.php...fo&userid=3166
View this thread: http://www.excelforum.com/showthread.php?threadid=51346

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a

 
      02-17-2006, 01:46 AM
=count(indirect(a20))

elf21 wrote:
>
> I have named several ranges on my sheet with names of cities such as
> "newYork", "Chicago", "sanDiego" etc.
>
> I would like to use these ranges in a formula, but rather than type in
> these ranges I would like to use a cell reference that contains these
> names.
>
> For example, instead of typing =COUNT(Chicago) where "Chicago" is a
> range I have defined, I would like to be able to type something like
> =COUNT(A20) where A20 contains the text Chicago.
>
> I hope I am making myself clear.
> Thank you!
>
> --
> elf21
> ------------------------------------------------------------------------
> elf21's Profile: http://www.excelforum.com/member.php...o&userid=31660
> View this thread: http://www.excelforum.com/showthread...hreadid=513468


--

Dave Peterson
 
Reply With Quote
 
elf21
Guest
Posts: n/a

 
      02-17-2006, 02:28 AM

Brilliant!

Thank you!


--
elf21
------------------------------------------------------------------------
elf21's Profile: http://www.excelforum.com/member.php...o&userid=31660
View this thread: http://www.excelforum.com/showthread...hreadid=513468

 
Reply With Quote
 
elf21
Guest
Posts: n/a

 
      02-19-2006, 11:56 PM

I just realized it doesn't work if the cell contains spaces such as in
"San Diego". I suppose it only reads the first word: San. How can I
get it to interpret the entire cell??

Thanks.


--
elf21
------------------------------------------------------------------------
elf21's Profile: http://www.excelforum.com/member.php...o&userid=31660
View this thread: http://www.excelforum.com/showthread...hreadid=513468

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a

 
      02-20-2006, 12:23 AM
But you can't have a named range that includes a space.

If you name the range San_Diego (note the underscore), you could use:
=count(indirect(substitute(a20," ","_")))

If you name the range SanDiego (no spaces), you could use:
=count(indirect(substitute(a20," ","")))

elf21 wrote:
>
> I just realized it doesn't work if the cell contains spaces such as in
> "San Diego". I suppose it only reads the first word: San. How can I
> get it to interpret the entire cell??
>
> Thanks.
>
> --
> elf21
> ------------------------------------------------------------------------
> elf21's Profile: http://www.excelforum.com/member.php...o&userid=31660
> View this thread: http://www.excelforum.com/showthread...hreadid=513468


--

Dave Peterson
 
Reply With Quote
 
elf21
Guest
Posts: n/a

 
      02-20-2006, 12:32 AM

I realized that shortly after I wrote it, that's why I deleted my post.
But I see you got to it before I had a chance to delete it!

Thank you for that other tip - using substitute. It allows for me to
retain the spaces within the contents of the cells - which simply looks
better on the spreadsheet.


--
elf21
------------------------------------------------------------------------
elf21's Profile: http://www.excelforum.com/member.php...o&userid=31660
View this thread: http://www.excelforum.com/showthread...hreadid=513468

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Absolute Cell Reference Across A Range SamuelT Excel Newsgroup 5 11-08-2005 02:37 PM
More than 1 cell reference/range in formula 0-0 Wai Wai ^-^ Excel Newsgroup 2 09-07-2005 08:32 AM
Refer to cell in Named Range Ruth Excel Newsgroup 3 09-05-2004 09:05 PM
use a formula to reference a named range ryanb. Excel Newsgroup 1 07-06-2004 09:51 PM
Change named range to "A1" style reference mb Excel Newsgroup 1 02-12-2004 10:55 PM



All times are GMT. The time now is 02:12 PM.