+ Reply to Thread
Results 1 to 3 of 3

Build reference to different worksheet by extracting cell text

  1. #1
    Registered User
    Join Date
    03-14-2007
    Posts
    32

    Build reference to different worksheet by extracting cell text

    Hi,

    I like to dynamically build a reference to a worksheet called "1"and read the contents of cell D3.

    Usually this would read ='1'!D3, however I need to build the reference to the worksheet ("1") dynamically by reading the last character of a cell in the current worksheet, eg:

    J9: Name 1


    I've tried using =RIGHT(J9,1)!D3 or ='RIGHT(J9,1)'!D3 to create the reference, however this doesn't seem to work. Any ideas?

  2. #2
    Registered User
    Join Date
    03-14-2007
    Posts
    32

    Re: Build reference to different worksheet by extracting cell text

    I think I might have answered my own question.

    I now have the following and it seems to work:
    =INDIRECT(RIGHT(J10,1)&"!D3")

    However, despite reading an explanation, I'm not quite sure what the indirect function actually does?
    Anyone have a good explanation?

    Thanks!

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Build reference to different worksheet by extracting cell text

    It does exactly what you've discovered. It lets you "piece together" text strings to create what ultimately looks like a reference to a cell or range, then allows that text string to actually be used AS a cell reference and/or range.

    IN your use, you're constructing a reference to a single cell, and as such it will simply display the value of said reference.

    If that takes care of your need, please select Thread Tools from menu above and set this topic to SOLVED.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1