+ Reply to Thread
Results 1 to 35 of 35

Pulling a Range of Dates and their Corresponding Values

  1. #1
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Pulling a Range of Dates and their Corresponding Values

    Hi all,

    I'm new here, so forgive me if I'm asking the wrong type of question. I have a database that lists performance data by a group of people for a long range of dates. How do you recommend I pull the data for one specific person for a give range of dates? Would vlookup work or will I have to go into VBA?

    Thanks,
    Simba

  2. #2
    Valued Forum Contributor Saarang84's Avatar
    Join Date
    02-19-2009
    Location
    Chennai, India
    MS-Off Ver
    XL 2003 to 2010
    Posts
    812

    Re: Pulling a Range of Dates and their Corresponding Values

    Hi,

    Welcome to the Forum.

    Your requirement can be fulfilled with sheet formulas. Kindly upload a workbook with sample data (do remove sensitive information).
    If my assistance has helped, there is a reputation icon * on the left hand corner below the post - you can show your appreciation to the user who has helped in resolving your requirement.

    If your requirement has been solved please mark your thread as Solved.
    In the menu bar above the very first post, select Thread Tools, then select "Mark this thread as Solved".

    Kindly use [FORMULA] or [CODE] tags when posting your code.

    Regards,
    Sarang

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Pulling a Range of Dates and their Corresponding Values

    Use a pivot table for that kind of problem.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    DirecterReturnsHelp.xlsm

    I want to be able to reference a certain date and manager, and then pull up the given values.

    So a pivot table wouldnt be ideal in this situation.

  5. #5
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Does this help? Copy Sheet2!B3:C3 down for the range of dates you want.
    DirecterReturnsHelp.xlsm
    Please add reputation by clicking on the * if I have helped.
    Please mark the thread SOLVED if your issue has been resolved.
    Thanks, Glenn.

  6. #6
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    This works, but I'm wondering if there is a more automated way of doing this?

    I would like to run an analysis on the range of data that I get, and I would need to do this for a bunch of different people/range of dates. The database that I am working with is pretty extensive, and that data isnt filled in for all dates (some people joined later than others). Sometimes I need to compare certain people, and go back from the earliest common date to the most recent, and then run an analysis on the two.

    The more I look at this, the more I think I'm going to have to use VBA. Im just not as well-versed in that.

  7. #7
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Do you need the detail of the date ranges, or just things like the totals or averages. You said you needed to further analyse the data within those ranges and there may be a better way to do that. SUMIFS, COUNTIFS and AVERAGEIFS for instance can use multiple criteria such as date range and manager's name. OFFSET function can also be used to specify a range to be further analysed.

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Pulling a Range of Dates and their Corresponding Values

    Then i'm interested how the result should be.

    You didn't add this in your file.

  9. #9
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    The analysis I need to do uses sumifs, countifs, averages, stdev, skew, etc... I didnt include it because I didnt know how to change the range values in the functions to match the range of the data per specified date range.

  10. #10
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    In the example you uploaded try something like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    to get the range to further analyse.

  11. #11
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    I made a slight edit to post 10 so use the current post, not the email notification you received from the forum.

  12. #12
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    Will this work if I want to reference ranges in another workbook?

  13. #13
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Yes. It would just need something like: OFFSET('[Path and filename]Sheetname'!$C$6,MATCH([Start date of range],'[Path and filename]Sheetname'!$C$7:$C$22,0),MATCH([Director name],'[Path and filename]Sheetname'!$D$6:$F$6,0),COUNTIFS('[Path and filename]Sheetname'!$C$7:$C$22,">="&[Start date of range],'[Path and filename]Sheetname'!$C$7:$C$22,"<="&[End date of range]),1)

  14. #14
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    I put this in and double checked it, but I'm still getting a #value! sign

  15. #15
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    I'm heading out for a bit, but if you upload some sample files I'll have a look when I get back.

  16. #16
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    Thank you for your help, I really appreciate it

  17. #17
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    See the attached file. In a separate book to the sample you uploaded I summed the data from your upload for the range 13/2/12 to 20/2/12 for Frank
    Book1.xlsx
    You will need to of course change the references to match your data and file locations.
    Last edited by gak67; 06-13-2014 at 07:46 PM.

  18. #18
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Pulling a Range of Dates and their Corresponding Values

    With an pivot table (as suggested)

    See tab Oeldere

  19. #19
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    DirecterReturnsHelpUpdated.xlsmI uploaded a file with some of the calculations that I need to do. Hopefully this will give you a better sense of what I'm trying to do.

    I have a set group of calculations that I need to do for any given range of data. The only thing that needs to change is the director data and the dates.

    All of the data is located on a separate worksheet. Its similar to the sample data I provided, except there are a lot more people and a lot more dates. Currently, if I want to make a new comparison, which I do a lot, I have to copy and past the range I want into a new worksheet. I then have to create a table like the one in the worksheet provided and redo all the calculations. It gets pretty tedious and I feel like there is a way to make this more automated.

    Ideally, all i would need to change would be the director and the dates, and then all of the calculations would be done so I dont have to redo them every time.

    Sorry if I have been unclear, I'm just trying to figure out the best way to do this.

    Thanks
    Last edited by SimbaStriker; 06-16-2014 at 07:02 AM.

  20. #20
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Try these, but with the parts in red replaced with the references to your separate workbook (with both workbooks open select the part of the formula in the cell and then select the relevant part in the other workbook).
    In L11:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L12:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L13:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L14:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L15:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L16:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L17:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    In L18:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    See attached:DirecterReturnsHelpUpdated.xlsm

  21. #21
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    I plugged in the references from my sheets and the numbers looked good. However, I checked my my numbers against the old way that I did it and they are a little off. I can't seem to figure out whats going wrong. Any ideas?

    Maybe something to do with the -6? I'm a little confused as to what that actually means.
    Last edited by SimbaStriker; 06-16-2014 at 09:46 AM.

  22. #22
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    I can think of two likely things to look at. The -6 is one of them, The MATCH function returns the position (in this case the number of rows down column C) of the thing you're looking up (in this case the start of your date range). As your example had 6 rows before the data started at the top of the column I needed to put the -6 in the formula. You will need to adjust that number to suit your data. Count any non data cells in the date column, including blank cells, headings, etc.

    The other option is the $K$9-$K$8+1 towards the end. Your sample data showed no gaps in the dates so I assumed that would continue for your full data source. The height of the range to be analysed needs to be the number of rows between the from date and the to date, which if there are no gaps is simply the number of days between the two, plus 1 to make it inclusive of both the start and end dates. If your source data is not continuous there are ways to fix that, so let me know.

  23. #23
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    Yup, I changed the -6 and now everything works great. Thanks again for your help,

    One last question: in addition to the ITD formula, I'm trying to do a YTD formula that only takes into account the most recent year (theoretically, the data used in the calculations will always be from some specified date to the current date). Is there a way to do that?

    Thanks again

  24. #24
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    In the first match function replace the $K$8 with DATE(YEAR(TODAY(),1,1) and replace the $K$9-$K$8+1 towards the end with TODAY()-DATE(YEAR(TODAY(),1,1)+1

  25. #25
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    You have open parentheses with the date functions. Should they just go at the end of the formula like:
    DATE(YEAR(TODAY(),1,1)) and TODAY()-DATE(YEAR(TODAY(),1,1))+1?

  26. #26
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Sorry. No, your options are not the right ones. It should be DATE(YEAR(TODAY()),1,1)

  27. #27
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    So I'm getting a N/A error, and I think it could be because my data is monthly, and not daily. Would I have to use the end of month function then?

  28. #28
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Upload a sample of your ACTUAL data and I'll have a look. I'm heading to work now so it may be a while before I can have a look at it.

  29. #29
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    MonthlyDataSample.xlsx

    It's a lot like what I posted before, except all the dates are the last day in each month. i can't post my actual data

  30. #30
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Yeah, sorry, I should have said your ACTUAL data layout. Didn't mean to ask you to upload sensitive data.

  31. #31
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    A couple of questions to clarify how to proceed.

    What form will the from and to dates take? Ie. will it be the first of a month to a last of a month? Will it be the last of a month to the last of a month since that is the way the dates in the data are? Could it be any date of a month to any date of a month?

    If it is any date in a month do you include that month? Eg. if it was from 15 June 2012 to 15 May 2013 is your starting point the 30 June 2012 data or do you start with the 31 May 2012 data. Do you end with the 31 May 2013 data or do you finish with the 30 April 2013 data?

    Cheers

  32. #32
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    I think I figured it out. The data is reported at the end of each month so I used EOMONTH(DATE(YEAR(NOW()),1,1),0) and EOMONTH(NOW(), 0)-EOMONTH(DATE(YEAR(NOW()),1,1),0)+1 to get my YTD function. There may be a simpler way to do this, but it seems like it works.

  33. #33
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    YTD function I don't think will give you what you want. For instance as at today (18 June 2014) your formula will give you 30 June 2014 (or 41820) - 31 Jan 2014 (or 41670) +1, or 151 rows of data, when you really want 6 rows of data (Jan 14 - Jun 14). You could try COUNTIFS(A:A,">="&EOMONTH(DATE(YEAR(TODAY()),1,1),0),A:A,"<="&EOMONTH(TODAY(), 0))). This assumes the dates are in column A, and I prefer to use TODAY() rather than NOW() when times are irrelevant.

  34. #34
    Registered User
    Join Date
    06-13-2014
    Posts
    16

    Re: Pulling a Range of Dates and their Corresponding Values

    I tested my new sheet by using some data and doing the calculations the old way. The values I got from the old way were exactly the same as the new way, even with my EOMONTH functions. Maybe instead of the 151 rows would only apply if it were daily data?

  35. #35
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: Pulling a Range of Dates and their Corresponding Values

    Yes, 151 rows is the right number for daily data.

+ 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. Pulling specific dates out of a list of dates
    By bohodgman in forum Excel General
    Replies: 3
    Last Post: 08-07-2013, 01:09 AM
  2. [SOLVED] Averaging values if desired dates fall between range of dates
    By gbcpurdue in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2012, 02:51 PM
  3. Replies: 1
    Last Post: 12-14-2011, 11:32 PM
  4. Pulling data from a range of dates
    By wtsublette in forum Excel General
    Replies: 1
    Last Post: 03-08-2011, 10:19 AM
  5. [SOLVED] Find dates in a range; then sum values in that range by a criteria
    By Anders in forum Excel General
    Replies: 4
    Last Post: 10-21-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