+ Reply to Thread
Results 1 to 20 of 20

List names of other worksheets as data/text in a column of the "master worksheet"

  1. #1
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Red face List names of other worksheets as data/text in a column of the "master worksheet"

    Honoured Excel Masters!

    Here's my challenge that I humbly ask you to help me with:

    I want set up a workbook with a "master worksheet" at the beginning (i.e. Sheet1) with a column that lists the names of the other worksheets/tabs in the workbook, automatically updated as I add or rename these other worksheets/tabs. Once I can grab the names of the other worksheets, I can easily reference their data for displaying in the other columns of the master worksheet.

    Is there a way to do this with just regular formulas and functions? Or is it necessary to make a macro?

    NOTE: For my purpose it would actually be better to reference worksheets by numbers and not codenames, since I'd like to keep my table in the master worksheet sorted in the same order as the additional worksheets (i.e. if I reorder the sheets, I want the table in the master worksheet to be reordered as well).

    Thank you so much in advance for any help!
    Last edited by ExcelHack3r; 10-31-2013 at 09:14 AM. Reason: Solved.

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    See this for a formula method:

    http://www.excelforum.com/tips-and-t...a-formula.html
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    Dear Tony, this worked like a charm, thank you so much!!!

    Now, it turned out the next part wasn't as easy as I thought:

    Quote Originally Posted by ExcelHack3r View Post
    Once I can grab the names of the other worksheets, I can easily reference their data for displaying in the other columns of the master worksheet.
    I want to pull in data from the other worksheets to the master worksheet using this generated list of worksheet names, so I need to input the value of another cell into the basic syntax for getting the value of another cell...

    Let's say I have used your solution above to list the Worksheet names in Col A. For example, cell A5 contains the name for "Worksheet 4" since cell A1 contains the name of the master worksheet, according to your formula.

    Now, I want to add the values of Col B in each subsequent Worksheet in Col B of the master worksheet, ditto for Col C, Col D etc.

    The regular code for cell D4 that should display the value of cell D1 in Worksheet 4 would be
    Please Login or Register  to view this content.
    However, I am looking for a solution that inputs the name of Worksheet 4 from cell A5, in principle like this code, which obviously does not work at all:

    Please Login or Register  to view this content.
    So, how to do this??

    Thank you so much in advance!

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Try it like this...

    =INDIRECT("'"&A5&"'!D1")

  5. #5
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by ExcelHack3r View Post
    The regular code for cell D4 that should display the value of cell D1 in Worksheet 4 would be
    Please Login or Register  to view this content.
    However, I am looking for a solution that inputs the name of Worksheet 4 from cell A5, in principle like this code, which obviously does not work at all:

    Please Login or Register  to view this content.
    Note; if I just mark cell A5 and copy it into the function expression for cell D4, it works. So what I need is something that can emulate this - copying the contents of cell A5 as pure text, in order to input it as a variable in the expression for cell D4.

  6. #6
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    Try it like this...

    =INDIRECT("'"&A5&"'!D1")
    Sorry, I posted before refreshing to see that you had posted meanwhile.

    Super, this does the trick!!!

    Thank you :-) :-)

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    You're welcome. Thanks for the feedback!

  8. #8
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    Try it like this...

    =INDIRECT("'"&A5&"'!D1")
    However, this doesn't work when I try to use it for nested expressions. I just posted a lengthy reply that got lost (replaced with a duplicate of my previous post #6) when I pressed "Submit Quick Reply" so I have to rewrite it.
    Last edited by ExcelHack3r; 10-30-2013 at 10:38 AM. Reason: My actual post got replaced with a duplicate of my previous post #6

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Post the formula that you're trying to end up with.

  10. #10
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    So, the next step for me is to use the worksheet name that you helped me extract in a nested expression.

    What I am trying to achieve is to convert a US currency value from US format to European format, where the unit separator is a comma (",") instead of the US dot ("."). This is by the way also the reason why I can't use any of the code examples here directly, I always have to replace all the commas with semicolons in all function expressions...

    The starting point is a US currency value on the following format, however the number format is "text", not "currency": $#.##

    What I need to do is to remove the dollar sign and replace the , with . in order to process it as a number (in a cell with USD currency formatting, so a new dollar sign appears).

    My approach with REPLACE causes additional problems because it takes positional input parameters and the currency values I work with have varying numbers of digits (1 or 2, all amounts are below $100).

    Here's my attempt, which doesn't compute because apparently the " signs used by REPLACE crash with the input format of INDIRECT:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    Post the formula that you're trying to end up with.
    To sum up: I try to convert
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    * Here, TEXT and CURRENCY USD are not functions but show the number formatting.
    Last edited by ExcelHack3r; 10-30-2013 at 10:48 AM. Reason: Added comment *

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Ok, so A5 is the sheet name. Let's assume that name is Sheet10.

    What's $C$2? Is that the cell you want to link to on Sheet10?

    In the INDIRECT function what do the 2 and 5 mean? Those are invalid characters as far as I can see.

  13. #13
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    Ok, so A5 is the sheet name. Let's assume that name is Sheet10.

    What's $C$2? Is that the cell you want to link to on Sheet10?
    Actually it would be something like Sheet4, since the offset is only 1 according to the previous setup you gave me. But that is NOT important ;-)

    And yes, you are correct sir - $C$2 is indeed the cell with the original text expression "$#.##" that I want to convert.

    Quote Originally Posted by Tony Valko View Post
    In the INDIRECT function what do the 2 and 5 mean? Those are invalid characters as far as I can see.
    This is where the trouble starts, those numbers are input parameters for the MID function.

    I took the INDIRECT function you gave me earlier:

    Please Login or Register  to view this content.
    and inserted a modified version of it in my working nested expression where I have to enter the Worksheet Name manually:

    Please Login or Register  to view this content.
    So it's the marriage of the INDIRECT with the nested function that doesn't work.

    My take is that if you have a more elegant way than VALUE+REPLACE+MID to convert the US format to European format, then the INDIRECT function would probably be more compatible.

    Thanks again!

    PS: I'm not allowed to give you more reputation now, but I will next time I can do it (I have to give to some other people first).

  14. #14
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Does C2 contain this literal string: $#.## ?

    Or, does C2 contain a numeric value in the format $#.## ?

  15. #15
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    Does C2 contain this literal string: $#.## ?

    Or, does C2 contain a numeric value in the format $#.## ?
    The last one, that is the format. 1 or 2 digits in front of the unit separator, i.e. amounts below 100 USD. And how to remove the dollar sign is also unsolved, RIGHT cannot do it unless you introduce an IF clause, and that seems like way overkill. There must be a search-replace thing that can simply delete the dollar sign and change "." to ","?

  16. #16
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    I don't know how to do what you want.

    If Sheet4 C2 contains the number 7.25 we can get it to look like 7,25 but it won't be a numeric number, it'll be a TEXT string.

    =SUBSTITUTE(INDIRECT("'"&A5&"'!C2"),".",",")

    If you try to convert that TEXT string to a number then you'll get an error.

    I have no experience with international number formats such as #,##.

  17. #17
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    I don't know how to do what you want.

    If Sheet4 C2 contains the number 7.25 we can get it to look like 7,25 but it won't be a numeric number, it'll be a TEXT string.

    =SUBSTITUTE(INDIRECT("'"&A5&"'!C2"),".",",")

    If you try to convert that TEXT string to a number then you'll get an error.

    I have no experience with international number formats such as #,##.
    Thanks again for the code!

    The international number format simply works like this; the US number format is a text string to me just like the "7,25" is a text string to you. This is why I need to convert the text "$7.25" to "7,25" before it will be possible to change it to a number (with VALUE) and change the formatting to currency.

    Have to figure out how this should work together with VALUE (or similar).
    Your code from above didn't work right away, it should have returned something like "$7,25" I assume.

  18. #18
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Try this...

    =--SUBSTITUTE(SUBSTITUTE(INDIRECT("'"&A5&"'!C2"),"$",""),".",",")

    If C2 contains the TEXT string $7.25 and 7,25 is a number format for your location then that should work.

    The double unary minus -- does the same thing as the VALUE(...) function.

  19. #19
    Registered User
    Join Date
    10-29-2013
    Location
    Norway
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    Quote Originally Posted by Tony Valko View Post
    Try this...

    =--SUBSTITUTE(SUBSTITUTE(INDIRECT("'"&A5&"'!C2"),"$",""),".",",")

    If C2 contains the TEXT string $7.25 and 7,25 is a number format for your location then that should work.

    The double unary minus -- does the same thing as the VALUE(...) function.
    That did the trick - OH YEAH!

    Thank you so much Tony, this was really awesome Excel hacking from your side! I just took the nick, but you got the savvy.

    Now I'll have to save this in two versions, one for use in the US and one for use in Europe. I won't be able to test the US one, but it would be identical except for this formula I guess. Cheers and thank you one again !!!!

  20. #20
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: List names of other worksheets as data/text in a column of the "master worksheet"

    You're welcome. 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. Raw data column text to new worksheet - display data based on "Yes" filter
    By tsgallivan12 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-11-2013, 01:56 PM
  2. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  3. Replies: 1
    Last Post: 05-09-2013, 02:05 AM
  4. extracting data from multiple worksheets into a "master"
    By bj98040 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-04-2013, 03:18 PM
  5. Replies: 5
    Last Post: 09-19-2008, 04:02 PM

Tags for this Thread

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