+ Reply to Thread
Results 1 to 6 of 6

Adding up data that corresponds to a particular range of inputted dates using LOOKUP

Hybrid View

  1. #1
    Registered User
    Join Date
    07-31-2008
    Location
    Philadelphia, PA
    Posts
    40

    Adding up data that corresponds to a particular range of inputted dates using LOOKUP

    I have a sheet with a column of dates (ColumnA), and next to it is a second column with data that corresponds to those dates (ColumnB). I have a field for a user to type in a start date (FieldA) and a field for a user to type in an end date (FieldB) and i want it to add up all the data in ColumnB that corresponds to the range of dates from FieldA to FieldB in Cell1. I know how to use LOOKUP to find the data that corresponds to FieldA and the data that corresponds to FieldB, but how do I make it sum up all the data for all the dates in between as well? This was my best guess for code for Cell1:

    =SUM(LOOKUP(FieldA, ColumnA, ColumnB):LOOKUP(FieldB, ColumnA, ColumnB))
    But that doesn't work. I want to add up all the data that corresponds to an entered date range, and I'm missing something. Thanks!
    Last edited by petalred; 04-06-2010 at 05:35 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Adding up data that corresponds to a particular range of inputted dates using LOO

    Hi Petalred, perhaps:

    =SUMPRODUCT((A1:A50>=FieldA)*(A1:A50<=FieldB)*(B1:B50))

    where FieldA and FieldB are cell references.

  3. #3
    Registered User
    Join Date
    07-31-2008
    Location
    Philadelphia, PA
    Posts
    40

    Re: Adding up data that corresponds to a particular range of inputted dates using LOO

    Hmm, I tried that and couldn't get it to work. The problem is I want FieldA and FieldB to specify a range in ColumnA and then to sum up only the corresponding fields from ColumnB. Does that make sense?

  4. #4
    Registered User
    Join Date
    07-31-2008
    Location
    Philadelphia, PA
    Posts
    40

    Re: Adding up data that corresponds to a particular range of inputted dates using LOO

    If I could find some function for LOOKUP commands that cares only that my search criteria falls within a certain range this could easily be done with VLOOKUP, like so:

    =VLOOKUP(???(FieldA:FieldB), ColumnA:ColumnB, 2)
    where ??? is a function that uses all the values between FieldA and FieldB as lookup values.

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Adding up data that corresponds to a particular range of inputted dates using LOO

    If FieldA has a start date, and FieldB has an end date (creating a "range" of dates) then my SUMPRODUCT formula should work just fine. Change your ranges to suit your actual data.

    If it does not work, what result are you getting? It may be easiest just to upload a sample workbook with what you have in mind, and your expected results manually entered.

  6. #6
    Registered User
    Join Date
    07-31-2008
    Location
    Philadelphia, PA
    Posts
    40

    Re: Adding up data that corresponds to a particular range of inputted dates using LOO

    It worked after all! I'm not sure why it didn't work the first time. Thanks!

+ 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