+ Reply to Thread
Results 1 to 9 of 9

Lookup formula based on a condition and date timeframe

Hybrid View

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Lookup formula based on a condition and date timeframe

    In an Excel workbook I have the following Sheets:

    Sheet1 contains in addition to other data, client purchase information:

    PurchaseDate ClientNo. AccountRep
    31-Jan-2012 1 ?
    23-Feb-2012 7 ?
    17-Mar-2012 24 ?
    09-Apr-2012 77 ?
    02-May-2012 89 ?
    25-May-2012 103 ?
    17-Jun-2012 304 ?

    Sheet2 contains a list of Account Reps responsible for the account through time
    Client# StartDate EndDate RepName
    304 02-Jan-2011 01-May-2011 Tim
    304 02-May-2011 31-Dec-2011 John
    304 01-Jan-2012 01-Aug-2012 Jen
    77 02-Jul-2011 01-Nov-2011 Jack
    77 02-Nov-2011 31-Dec-2012 Heather
    77 01-Jan-2012 01-Jul-2013 Cathy

    I would like to write a formula in sheet 1 under Account Rep to identify the appropriate Account Representative in sheet2 based on the account number and the date of the transaction.
    Last edited by rmitri; 06-14-2013 at 10:53 AM.

  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: Lookup formula based on a condition and date timeframe

    Try this array formula**:

    =IFERROR(INDEX(Sheet2!D$2:D$7,MATCH(1,IF(Sheet2!A$2:A$7=B2,IF(A2>=Sheet2!B$2:B$7,IF(A2<=Sheet2!C$2:C$7,1))),0)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Forum Contributor
    Join Date
    02-28-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    272

    Re: Lookup formula based on a condition and date timeframe

    I think this is what you are looking for
    Attached Files Attached Files
    Please consider adding a * if I helped

  4. #4
    Registered User
    Join Date
    06-13-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Lookup formula based on a condition and date timeframe

    WFM007,
    The formula should have returned Heather in cell C5 and Jen in cell C8 which is not the case.
    Last edited by rmitri; 06-14-2013 at 11:39 AM.

  5. #5
    Forum Contributor
    Join Date
    02-28-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    272

    Re: Lookup formula based on a condition and date timeframe

    Hi Rmitri,

    As per your post, if date & client # matches then it should return to "CATHY".

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

    Re: Lookup formula based on a condition and date timeframe

    Quote Originally Posted by rmitri View Post
    WFM007,
    The formula should have returned Cathy in cell C5
    I think the correct result should be Heather.

    That's what my suggestion returns.

  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: Lookup formula based on a condition and date timeframe

    Here's a small sample file that demonstrates this...

    rmitri.xlsx

  8. #8
    Registered User
    Join Date
    06-13-2013
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Lookup formula based on a condition and date timeframe

    Worked perfectly Tony, exactly what I was looking for.
    Thank you.

+ 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