+ Reply to Thread
Results 1 to 11 of 11

Forumla which refers to a cell which refers to a sheet name

  1. #1
    Registered User
    Join Date
    12-03-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Forumla which refers to a cell which refers to a sheet name

    Hello,

    I have a workbook with many worksheets which all have very unique names. Certain data from each sheet is collected onto one sheet for an overview. On the overview sheet, I would like to be able to type the following function, =SUM('A2'!L$23:L$25), where A2 refers to a cell which has the same name as the sheet of interest. This way I do not have to type in the sheet name in all the overview cells. Obviously this formula will not work, as I have tried. Any ideas on a formula which will accomplish what i am looking for? Below is a sample of my overview sheet, where the numbers 78 and 46 exist on a sheet with the same name as Sheet Name. So instead of typing =SUM('Sheet Name'!,L$23:L$25), I would like to type something like =SUM('A2'!L$23:L$25). This way I only have to type the sheet name once and i can drag down the above formula and it will automatically select the data from the sheet name which my formula references.


    Sheet Name 11/4/2012 78 46

    Thanks
    Andy

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: Forumla which refers to a cell which refers to a sheet name

    Use the indirect function. =sum(indirect(A2)&.......)

    http://www.techonthenet.com/excel/formulas/indirect.php

    Alan
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    12-03-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Forumla which refers to a cell which refers to a sheet name

    Thanks for the reply. Maybe my use of "refers" in my original post was misleading. The cell which "refers" to a sheet name is actually a cell which I have typed in the same name as the sheet name, so technically it does not refer to the sheet name. Maybe that is the reason that the INDIRECT funtion is not working for me.
    A B
    1 Name Value
    2 Andy 10
    3 Bob 20

    So current formula for B2 would be ='Andy'!C38 and forumla for B3 would be ='Bob'!C38. The names are typed in by me and I change the sheet tab name to match. It would be great if I could just put in ='A2'!C38 and it would result in 10 and ='A3'!C38 would result in 20. Should the INDIRECT funtion work and I am misusing it or is there a different way that I must go about it?

    Appreciate the help

  4. #4
    Registered User
    Join Date
    12-03-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Forumla which refers to a cell which refers to a sheet name

    I apologize, but the forum skewed my table that i typed in. Name and Value are columns A and B respectively.

  5. #5
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Forumla which refers to a cell which refers to a sheet name

    If "Andy" is in cell A2, then try this in B2:

    =INDIRECT(A2&"!C38")

    - Moo

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,718

    Re: Forumla which refers to a cell which refers to a sheet name

    If you always want to get the data from cell C38 in whichever sheet, then you can put this in B2:

    =INDIRECT("'"&A2&"'!C38")

    then copy down as far as you need to.

    Hope this helps.

    Pete

  7. #7
    Valued Forum Contributor
    Join Date
    09-10-2012
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2010
    Posts
    929

    Re: Forumla which refers to a cell which refers to a sheet name

    Hi awiller2,

    Alan is correct, you should be using the INDIRECT function.

    Quick lesson: the indirect function reads in a text value, but looks at it like a formula...

    So if A2=Andy, then in B2, you should type =INDIRECT(A2&"!C38") [This is equivalent to simply typing =Andy!C38

    If you notice the inside of the INDIRECT function is a text that returns: Andy!C38 and with the indirect function, you should get 10.

    Notice that if your tab names have spaces, then you have to have single quotes within the INDIRECT function... so in general, your forumula should be
    =INDIRECT("'"&A2&"'!C38")


    Let us know if you still don't follow...

    re-post: you are right Moo... you guys are fast!

  8. #8
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Forumla which refers to a cell which refers to a sheet name

    Pete's the quick one... I must have beat him by a millisecond this time.

    - Moo

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,718

    Re: Forumla which refers to a cell which refers to a sheet name

    I think we are all fishing for the same threads that we can respond to - I'll take a coffe break now to give you a chance !! <bg>

    Pete

  10. #10
    Registered User
    Join Date
    12-03-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Forumla which refers to a cell which refers to a sheet name

    Awesome! Yes, that works great! Can't thank you all enough.

    Cheers!

  11. #11
    Forum Expert Moo the Dog's Avatar
    Join Date
    09-28-2012
    Location
    Wisconsin
    MS-Off Ver
    Office 365 (PC & Mac)
    Posts
    1,845

    Re: Forumla which refers to a cell which refers to a sheet name

    We're glad to help!

    - Moo

    - - - - - - - - - -
    If the solutions provided have solved your issue, please mark the thread as [SOLVED] by clicking on 'Thread Tools' above your first post and select 'Mark Thread as Solved'.

    Also, a great way to say thanks to users who have offered assistance is to click on the small star at the bottom-left corner of one of their posts. It's always appreciated.

+ 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