+ Reply to Thread
Results 1 to 15 of 15

Referencing Worksheet Page

  1. #1
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Referencing Worksheet Page

    Is there a way to reference a cell value for the worksheet number in the formula below? My worksheets are named 1-10 with worksheet '1' being used in the example. With the formula in cell B2 I would like it to reference the value (1-10) of cell A1 for the worksheet name.

    Formula = MATCH(P3,'1'!$AP$4:$AP$2500,0)

    Ex:
    A1 = 1 ; Formula = MATCH(P3,'1'!$AP$4:$AP$2500,0)
    A1 = 2 ; Formula = MATCH(P3,'2'!$AP$4:$AP$2500,0)
    A1 = 3 ; Formula = MATCH(P3,'3'!$AP$4:$AP$2500,0)

    I have tried using Text() and NumberValue() within the apostrophes, but neither accomplished what I am after.

    Any help would be greatly appreciated!

    J.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,079

    Re: Referencing Worksheet Page

    Try

    =MATCH(P3,INDIRECT(A1&"!$AP$4:$AP$2500"),0)
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Referencing Worksheet Page

    I'm not quite sure how your data is setup, but it looks like you may want to look into INDIRECT for what you're trying to accomplish.
    Spread the love, add to the Rep

    "None of us are as smart as all of us."

  4. #4
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Re: Referencing Worksheet Page

    Thanks for the responses! Unfortunately I am still unable to get it to work. When using the indirect function as suggested the cell returns the error #REF. The description for the Indirect() function does sound like it should do what I am after, but I have not been able to put together the right format yet.

    I have attached an example of what I am after. In the example there is a "Main" worksheet as well as three others named "1", "2", and "3". On the "Main" page I would like to be able to select the worksheet name (1,2,3) in the blue cells and then have the value from that worksheet populate in the corresponding green cells. I have also shaded the cells containing this data green for clarity. I need the formula to take the color in the "Main" list, find it in the selected (input) worksheet and return the appropriate value. Updating of course when the worksheet selection is changed.

    Example: Ex 3.xlsx

    Thanks for the help guys/gals,
    J.

  5. #5
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Re: Referencing Worksheet Page

    Just noticed it is something to do with how I am using the function and not necessarily the suggested formula. I simply typed in "INDIRECT(A1)" and still recieved the error #REF. Cell A1 contains the value I want, but is derived as the result of its own formula contained in that cell. Could it be a formatting issue? I tried formating A1 to text, but still no luck.

    Thanks,
    J.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Referencing Worksheet Page

    Formatting (generally) only changes the cosmetic of a cell, not its contents. Also, formulas work on the "answer of a formula" or what is displayed in a cell, not what the formula is.

    Can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  7. #7
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Re: Referencing Worksheet Page

    Thanks for the info. On the post just before my last one there is an example sheet and description. I attached it as : EX 3.xlsx

    Hopefully it is clean/clear enough.

    Thanks again!
    J.

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Referencing Worksheet Page

    oops sorry, missed that.

    Try this, copied down...
    =VLOOKUP(C3,INDIRECT("'"&D3&"'!$C$3:$D$12"),2,0)

    Note that INDIRECT() is used to convert a cell's contents into something excel can use as a reference in a formula. So apart from the actual cell you are referencing, all the other stuff needs to be "textified"

    If you were to refence sheet "1" in the normal manner, you would use this...
    =VLOOKUP(C3,'1'!$C$3:$D$12,2,0)

    But because you need to be able to specify the sheet name, the lookup reference range needs to be "fiddled with"
    '1'!$C$3:$D$12
    we need to reference the cell containing 1, which is D3, but thats not all there is to that sheet reference. Note the ' either side. Because of that, we need to "textify" those by putting them inside quotes...
    "'" (hard to see, but that is a " followed by a ' followed by another " with no spaces included)
    Likewise, the range now also needs to be "textified", using the same approach...
    "$C$3:$D$12"
    Because this is now text, and we need to include '! we can put that in there too...
    "'!$C$3:$D$12"

    Finally, we need to link all that together, which we do, using &
    =VLOOKUP(C3,INDIRECT( "'" & D3 & "'!$C$3:$D$12" ),2,0)
    I added spaces to show, but you can leave them out

    Hope that helps?
    Last edited by FDibbins; 03-12-2015 at 05:40 PM.

  9. #9
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Re: Referencing Worksheet Page

    I am nesting this inside a LOOKUP() function/formula for returning the data, but the MATCH() function has to return the correct value first which is where I am having issues.
    Even just using INDIRECT(A1) returns #REF no matter whether it is a number or text.

  10. #10
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Re: Referencing Worksheet Page

    ok...progress...apparently A1 needs to be in quotes inside the function as well. INDIRECT("A1")

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Referencing Worksheet Page

    Did you try the vlookup? My explanation should also enable you to work out what the INDIRECT() needs to look like, if there are multiple reference to other sheets, you will probably need to use multiple INDIRECT()'s

    INDIRECT() needs a reference to work with, not a number or just any old text. See the example below, I put text A1 in cell I1, Cell A1 contains the word Month...
    I
    1
    A1
    2
    Month

    I2=INDIRECT(I1)

  12. #12
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Re: Referencing Worksheet Page

    FDibbins, Thanks for the help. Still haven't been able to get anything to work. Tried many more combos last night as well as many this morning. Gonna keep trying, but may have to move on and just find a work around. Seems like this should be pretty straight forward. Back to the drawing board as they say...

    Thanks again,
    J.

  13. #13
    Forum Expert
    Join Date
    09-11-2014
    Location
    Washington, DC
    MS-Off Ver
    2016
    Posts
    1,907

    Re: Referencing Worksheet Page

    Try this in E3 and drag down to fill:

    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    02-05-2015
    Location
    Florida
    MS-Off Ver
    2013
    Posts
    30

    Re: Referencing Worksheet Page

    Guiness-Brilliant!.jpg

    THANK YOU MCMAHOBT! Worked perfectly! I took a few minutes to break down what the formula was "saying" so I could understand what references to change in order to fit where I needed it and viola, numbers in place of errors! Very happy to now be able to continue on without having to use a work around that would continue to bother me.

    Thank you again FDibbins and mcmahobt for the help! For a novice Excel guy this forum is a great resource/tool for learning and improving my skills.

  15. #15
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: Referencing Worksheet Page

    Love the pic, although some may not be able to view it. Happy to help and thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Page re-referencing
    By sparx in forum Excel General
    Replies: 3
    Last Post: 02-04-2014, 04:32 PM
  2. Referencing page setup header information in VBA
    By V C in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-11-2010, 05:50 PM
  3. Excel 2007 : Referencing a cell on another page
    By the_ghost in forum Excel General
    Replies: 3
    Last Post: 08-07-2009, 10:51 AM
  4. Multipage form: Referencing controls on one page
    By Post Tenebras Lux in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2006, 02:45 PM
  5. [SOLVED] Converting a muliple page worksheet to a single page worksheet
    By tkanasoot@yahoo.com in forum Excel General
    Replies: 2
    Last Post: 06-30-2005, 05:05 PM

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