+ Reply to Thread
Results 1 to 3 of 3

Problem referencing the first sheet of another workbook with changing names

  1. #1
    Registered User
    Join Date
    07-24-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Problem referencing the first sheet of another workbook with changing names

    Good Morning.

    I have a problem referencing the first sheet of another workbook.

    I download an assortment of CSV files that are then saved as Excel worksheets. They are various sales files, for 3 days, 7 days, 14 days, etc. So, I then have a summary worksheet which looks up the item on each of the sales spreadsheets so that I then have a summary per item with columns of each representing the sales figures over periods of time. The files are saved with names that do not change, but that is not the problem, but rather with the name on the tab of the first worksheet.

    The problem is that when the CSV files are downloaded (and I have no control over this) the name of the first sheet is always the date of the download, so that if I download those reports today, the first sheet name is "BusinessReport-7-24-2013", and changes every day. What I have been forced to do is change the sheet name in all of the CSV files when I save them to "a" instead of the date, so that I can use this formula in my summary worksheet:

    =SUMIF([Sales7.xlsx]a!$D:$D,A3,[Sales7.xlsx]a!$J:$J)

    Similary, in other columns, the formula would reference Sales10.xlsx, Sales14.xlsx, Sales30.xlsx, etc.

    I have thought of adding a cell with a formula for today's date and then reference that in the formula, but then the workbook would have errors before the other files are downloaded on that day.

    Is there ANY way to reference the first sheet of the other worksheets REGARDLESS of what the name of it is, to avoid having to do this step on every file every single time when saving them?

    I thank you in advance for any help.

    B.
    Last edited by floridahockeyguy; 07-24-2013 at 09:22 AM.

  2. #2
    Forum Expert
    Join Date
    06-26-2010
    Location
    Austin, TX
    MS-Off Ver
    Excel 2010
    Posts
    1,673

    Re: Problem referencing the first sheet of another workbook with changing names

    Maybe this will help. Put this UDF in a module of your summary sheet (google on how to add UDFs if you don't know how).
    Please Login or Register  to view this content.
    You use this like this:
    =FirstSheet("Sales7.xlsx")
    it will return the name of the first sheet. Note that the Sales7.xlsx file must be open.

    Now, to use it in your formula, you would need to use the INDIRECT function. Something like this:
    =SUMIF(INDIRECT("'[Sales7.xlsx]"&FirstSheet("Sales7.xlsx")&"'!$D:$D"),A3,INDIRECT("'[Sales7.xlsx]"&FirstSheet("Sales7.xlsx")&"'!$J:$J"))
    Pauley
    --------
    If I helped with your issue, I'd appreciate a rep bump (hit the '*' icon to the bottom left of this post).

  3. #3
    Registered User
    Join Date
    07-24-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Problem referencing the first sheet of another workbook with changing names

    Thanks, Pauley, you're a lifesaver! Works perfectly, and this will save me a bunch of time.

    Thanks again for taking the time to help, it is really appreciated.

    Have a great evening!

    B.

+ 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. GetPivotData referencing another (changing) workbook
    By Excel432 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-15-2012, 12:15 PM
  2. Changing Sheet Names Based on # Values in Names
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2010, 03:34 PM
  3. Changing Workbook names in VBA based on Open Workbook
    By peakymatt in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-16-2009, 12:06 AM
  4. Referencing Changing File Names
    By Dave1674 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-15-2007, 12:19 PM
  5. [SOLVED] Referencing Sheet Names
    By Stuart Grant in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-04-2005, 11:05 AM

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