Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22
Default How to retrieve Named Range name?

Hello,
Is there a way to retrieve range name if value is in the range?
For example I got this column wit names:
name 1
name 2
name 3
name 4
name 5
name 6
name 7
name 8
name 9
name 10
name 11
name 12
This column has name ranges:
1st range called €œCA€ has these names:
name 1
name 2
name 3
name 4
2nd range called €œDC€ has these names:
name 5
name 6
name 7
name 8
name 9
And the 3rd range is called €œWA€:
name 10
name 11
name 12
Lets say in different worksheet my formula returned €œname1, name8 and name
11€, in the same worksheet I would like to return the location or range name
associated with name.
Desired result:
__A_______B__
name 1___CA__
name 8___DC__
name 11__WA__
I think with nested IF functions I could achieve desired result; problem is
I am exceeding the limit of allowed nested functions. And I also dont want
to add additional column in original data sheet were I specify the
location/range name for each name.
Any suggestions?
Thank you,
Guntars

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4,393
Default How to retrieve Named Range name?

Why use range names?
On the first sheet use
name 1 CA
name 2 CA
name 3 CA
name 4 CA
name 5 DC
etc
with the names in say column A and the codes in column B

On the other sheet
A1 B1
name 1 =VLOOKUP(A1,Sheet1!A1:B1000,2,FALSE)

if name 1 is found in column A the formula will return the code from the B
column

best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"Guntars" wrote in message
...
Hello,
Is there a way to retrieve range name if value is in the range?
For example I got this column wit names:
name 1
name 2
name 3
name 4
name 5
name 6
name 7
name 8
name 9
name 10
name 11
name 12
This column has name ranges:
1st range called €œCA€ has these names:
name 1
name 2
name 3
name 4
2nd range called €œDC€ has these names:
name 5
name 6
name 7
name 8
name 9
And the 3rd range is called €œWA€:
name 10
name 11
name 12
Lets say in different worksheet my formula returned €œname1, name8 and name
11€, in the same worksheet I would like to return the location or range
name
associated with name.
Desired result:
__A_______B__
name 1___CA__
name 8___DC__
name 11__WA__
I think with nested IF functions I could achieve desired result; problem
is
I am exceeding the limit of allowed nested functions. And I also dont
want
to add additional column in original data sheet were I specify the
location/range name for each name.
Any suggestions?
Thank you,
Guntars


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 9
Default How to retrieve Named Range name?

Hello,

something like that ?:

with a function in a module,

Function NameIS(xR) As String
NameIS = "No Name"
For Each Xname In ActiveWorkbook.Names
On Error GoTo Nextname
Set RR = Range(Mid(Xname.RefersTo, 2, 99))
For Each Xcell In RR
If Xcell.Value = xR.Value Then
NameIS = Xname.Name
Exit For
End If
Next Xcell
Nextname:
If NameIS < "No Name" Then Exit For
Next Xname
End Function



Example

If cell C1 contains the string 'name 9'
if the formula in Cell D1 is '=NameIS(C1)'
The result in D1 shoud be 'DC'






"Guntars" a Γ©crit dans le message de
...
Hello,
Is there a way to retrieve range name if value is in the range?
For example I got this column wit names:
name 1
name 2
name 3
name 4
name 5
name 6
name 7
name 8
name 9
name 10
name 11
name 12
This column has name ranges:
1st range called €œCA€ has these names:
name 1
name 2
name 3
name 4
2nd range called €œDC€ has these names:
name 5
name 6
name 7
name 8
name 9
And the 3rd range is called €œWA€:
name 10
name 11
name 12
Lets say in different worksheet my formula returned €œname1, name8 and name
11€, in the same worksheet I would like to return the location or range
name
associated with name.
Desired result:
__A_______B__
name 1___CA__
name 8___DC__
name 11__WA__
I think with nested IF functions I could achieve desired result; problem
is
I am exceeding the limit of allowed nested functions. And I also dont
want
to add additional column in original data sheet were I specify the
location/range name for each name.
Any suggestions?
Thank you,
Guntars


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default How to retrieve Named Range name?

Hi,

I prefer Bernard's approach but here is a method you could use which matches
the question as you asked it:

=IF(OR(CA=E1),"CA",IF(OR(DC=E1),"DC",IF(OR(WA=E1), "WA")))

This formula assumes that the text you want to search for is in cell E1.
This is an array entered formula - Press Shift+Ctrl+Enter to enter it.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Guntars" wrote:

Hello,
Is there a way to retrieve range name if value is in the range?
For example I got this column wit names:
name 1
name 2
name 3
name 4
name 5
name 6
name 7
name 8
name 9
name 10
name 11
name 12
This column has name ranges:
1st range called €œCA€ has these names:
name 1
name 2
name 3
name 4
2nd range called €œDC€ has these names:
name 5
name 6
name 7
name 8
name 9
And the 3rd range is called €œWA€:
name 10
name 11
name 12
Lets say in different worksheet my formula returned €œname1, name8 and name
11€, in the same worksheet I would like to return the location or range name
associated with name.
Desired result:
__A_______B__
name 1___CA__
name 8___DC__
name 11__WA__
I think with nested IF functions I could achieve desired result; problem is
I am exceeding the limit of allowed nested functions. And I also dont want
to add additional column in original data sheet were I specify the
location/range name for each name.
Any suggestions?
Thank you,
Guntars

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
List Box - For Input Range can I use named range in another workbo dim Excel Worksheet Functions 2 January 3rd 08 06:10 PM
Referencing a named range based upon Range name entry in cell Barb Reinhardt Excel Worksheet Functions 14 June 20th 07 07:19 PM
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM


All times are GMT +1. The time now is 12:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"