+ Reply to Thread
Results 1 to 3 of 3

INDIRECT Functions and Date Ranges

  1. #1
    Registered User
    Join Date
    07-19-2013
    Location
    Albany, NY
    MS-Off Ver
    Excel 2010
    Posts
    45

    INDIRECT Functions and Date Ranges

    I have an INDIRECT function set up which should, in theory, concatenate data from a date range listed in another cell to correctly reference an external spreadsheet, which is named based on the date range it is generated for. The issue I'm running into is that the program which generates the external spreadsheet uses an MMDDYYYY format when naming its output file. This works fine if the month and day are both 10 or greater, but if they are less than 10, it doesn't work - for example, my INDIRECT function would return the date 5/3/13 as 532013, whereas the file name would be 05032013. I was contemplating using a series of IF statements to fix this, but there has to be a simpler way. Here are the relevant functions.

    Function which generates date range (later used in INDIRECT function):

    =MONTH(MIN(TransData!A2:A9882))&"/"&DAY(MIN(TransData!A2:A9882))&"/"&YEAR(MIN(TransData!A2:A9882))&" - "&MONTH(MAX(TransData!A2:A9882))&"/"&DAY(MAX(TransData!A2:A9882))&"/"&YEAR(MAX(TransData!A2:A9882))

    TransData is a different sheet within the same workbook where the various dates are stored in column A. I found that I needed to format the formula like this in order to get it to return actual dates instead of date sequence numbers.

    =AVERAGE(INDIRECT("'[DCQA_"&SUBSTITUTE(B4,"/","")&".xlsm]Total'!$C$3:$C$46"))

    Cell B4 is where the date range formula listed above lives. "DCQA_" is the beginning of the filename of the external sheet, followed by the date range in MMDDYYYY - MMDDYYYY format. So, the sheet for 12/2/13 to 12/7/13 would be named DCQA_12022013 - 12072013. I'm unfortunately unable to change the way the external program names its output sheets, so I have to fix this from within my workbook. Any thoughts on how I can handle this? Thanks in advance for any assistance.

  2. #2
    Forum Contributor amit.wilson's Avatar
    Join Date
    07-09-2013
    Location
    Gotham
    MS-Off Ver
    Excel for Mac 2011
    Posts
    283

    Re: INDIRECT Functions and Date Ranges

    D - here's something to try:

    Put in a date in A1: 1/1/2013
    In A2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    That should get you "DCQA_01012013" in A2.

    You could the same idea to create the filename.

    Hope this helped.

    Cheers
    <-- If you're happy & you know it...click the star.:-)

  3. #3
    Registered User
    Join Date
    07-19-2013
    Location
    Albany, NY
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: INDIRECT Functions and Date Ranges

    That did it! I was also able to make my date range formula far less complex by using the TEXT function. Thanks for your help!

+ 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. Excel 2007 : IF functions with Date ranges
    By ortiz718 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-24-2014, 03:20 PM
  2. [SOLVED] INDIRECT Query: How to incorporate INDIRECT to choose between two ranges?
    By The_Snook in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 10-18-2012, 06:28 AM
  3. DATE RANGES and other functions, formulas
    By isrdebie in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-20-2006, 11:55 PM
  4. [SOLVED] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Andy Wiggins in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 04:05 AM
  5. [SOLVED] Allow EXCEL INDIRECT(ADDRESS()) and INDIRECT(RANGE()) functions
    By Mike Barlow in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10: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