ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Variable names for named range (https://www.excelbanter.com/excel-discussion-misc-queries/135417-variable-names-named-range.html)

Barb Reinhardt

Variable names for named range
 
I'd like to reference a named range that is variable.

Let's say I have a Range called "Program_1_2" and A1 = 1 and B1 = 2

How do I do something like this "Program_"&A1&"_"&B1 and get it to display?

Thanks,
Barb Reinhardt

Niek Otten

Variable names for named range
 
Hi Barb,

=INDIRECT("Program_"&A1&"_"&B1)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Barb Reinhardt" wrote in message
...
| I'd like to reference a named range that is variable.
|
| Let's say I have a Range called "Program_1_2" and A1 = 1 and B1 = 2
|
| How do I do something like this "Program_"&A1&"_"&B1 and get it to display?
|
| Thanks,
| Barb Reinhardt



Barb Reinhardt

Variable names for named range
 
I should have posted that I tried using that before I posted this request and
I get a #REF error.

"Niek Otten" wrote:

Hi Barb,

=INDIRECT("Program_"&A1&"_"&B1)

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Barb Reinhardt" wrote in message
...
| I'd like to reference a named range that is variable.
|
| Let's say I have a Range called "Program_1_2" and A1 = 1 and B1 = 2
|
| How do I do something like this "Program_"&A1&"_"&B1 and get it to display?
|
| Thanks,
| Barb Reinhardt




Niek Otten

Variable names for named range
 
Hi Barb,

Are there any invisible characters in A1 or B1? Check with the LEN() function.
I assume you use A1 reference style, not R1C1.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Barb Reinhardt" wrote in message
...
|I should have posted that I tried using that before I posted this request and
| I get a #REF error.
|
| "Niek Otten" wrote:
|
| Hi Barb,
|
| =INDIRECT("Program_"&A1&"_"&B1)
|
| --
| Kind regards,
|
| Niek Otten
| Microsoft MVP - Excel
|
| "Barb Reinhardt" wrote in message
| ...
| | I'd like to reference a named range that is variable.
| |
| | Let's say I have a Range called "Program_1_2" and A1 = 1 and B1 = 2
| |
| | How do I do something like this "Program_"&A1&"_"&B1 and get it to display?
| |
| | Thanks,
| | Barb Reinhardt
|
|
|



Barb Reinhardt

Variable names for named range
 
No invisible characters
I'm also using the A1 reference style.



"Niek Otten" wrote:

Hi Barb,

Are there any invisible characters in A1 or B1? Check with the LEN() function.
I assume you use A1 reference style, not R1C1.

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Barb Reinhardt" wrote in message
...
|I should have posted that I tried using that before I posted this request and
| I get a #REF error.
|
| "Niek Otten" wrote:
|
| Hi Barb,
|
| =INDIRECT("Program_"&A1&"_"&B1)
|
| --
| Kind regards,
|
| Niek Otten
| Microsoft MVP - Excel
|
| "Barb Reinhardt" wrote in message
| ...
| | I'd like to reference a named range that is variable.
| |
| | Let's say I have a Range called "Program_1_2" and A1 = 1 and B1 = 2
| |
| | How do I do something like this "Program_"&A1&"_"&B1 and get it to display?
| |
| | Thanks,
| | Barb Reinhardt
|
|
|





All times are GMT +1. The time now is 06:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com