+ Reply to Thread
Results 1 to 6 of 6

Formula to extract a value based on a client code match AND that fits within a date range

  1. #1
    Registered User
    Join Date
    03-10-2020
    Location
    Tauranga, New Zealand
    MS-Off Ver
    10
    Posts
    3

    Question Formula to extract a value based on a client code match AND that fits within a date range

    Hi guys,

    I got two tables, in the attached file.

    I need to pull the value of units in Table 1 (Column L in Sheet1) into column H in Table 2 (Sheet 2).
    The number to pull will depend on:
    - The Student ID and the Subject match
    - The Service End in Table 2 (Column E) falls within the "Term" date range in Table 1 (from Dates in Columns G to Dates in Column H)



    If the criteria is not meet, could the formula display a message like "Code not found"?




    Please help!!!
    Attached Files Attached Files
    Last edited by Chiwidan; 09-05-2020 at 04:32 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Formula to extract a value based on a client code match AND that fits within a date ra

    Hi - in your comment Student ID and Subject match, I see Student ID in both sheets (no problem there) but what Subject match? I'm guessing Service Code

  3. #3
    Registered User
    Join Date
    03-10-2020
    Location
    Tauranga, New Zealand
    MS-Off Ver
    10
    Posts
    3

    Re: Formula to extract a value based on a client code match AND that fits within a date ra

    Hi Mikeava...

    Yes... I was needed to change the column headers for privacy and I missed that... but yes, you're right... Subject will be = Service Code

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: Formula to extract a value based on a client code match AND that fits within a date ra

    This is what I have come up with so far. I am still trying to figure out how to handle your 2nd criteria with the dates.
    Maybe someone can help figure this out. Will try and work on it again if no one picks it up.

    =IFERROR(INDEX(Sheet1!$L$2:$L$50,MATCH(A2&B2,Sheet1!$A$2:$A$50&Sheet1!$D$2:$D$50,0)),"Code not found")
    Note it is an array - so you have to do CTRL+SHIFT+ENTER to ensure it works properly.
    Also - If you are going to have more than 50 entries on Sheet 1 just change the formula from 50 (in 3 places) to 999 for example.

    FYI - I found an extra space after Literacy on Sheet 2 (row 34 or 35) so make sure extra spaces aren't in that column at the end or the formula won't pick it up.

    Let me know if you have any questions.
    Last edited by mikeava; 09-05-2020 at 10:13 PM.

  5. #5
    Registered User
    Join Date
    03-10-2020
    Location
    Tauranga, New Zealand
    MS-Off Ver
    10
    Posts
    3

    Re: Formula to extract a value based on a client code match AND that fits within a date ra

    Hi Mikeava,

    Thanks, this is looking promising... thank you so much for taking the time... honestly appreciated...

    Dan

  6. #6
    Forum Expert
    Join Date
    02-10-2019
    Location
    Georgia, USA
    MS-Off Ver
    Office 365
    Posts
    2,873

    Re: Formula to extract a value based on a client code match AND that fits within a date ra

    I changed your data on both pages into an Excel Table. This allows you to expand the data as far as you want without having to change any formula. If you don't want to do this,
    then the formula can be adjusted appropriately. If you need help with that, just ask.

    The formula below can go in cell H2 (you don't need to copy it down if you use the Excel Tables). See attached.

    =IFERROR(INDEX(Table2[Balance],MATCH(1,([@[Service End]]<=Table2[Term End Date])*([@[Service End]]>=Table2[Term Start Date])*([@[Student ID]]=Table2[Student ID])*([@[Service Code]]=Table2[Service Codes]),0)),"Code Not Found")
    Attached Files Attached Files

+ 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. How to extract data from range to a new worksheet if it fits 2 criteria
    By DrewBoid in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 06-15-2016, 03:36 AM
  2. [SOLVED] Formula/ Code to match records based on date
    By spearhead in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-28-2015, 09:50 AM
  3. formula that creates a three letter code based off of a date range
    By cmorten82 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-15-2015, 12:10 PM
  4. Formula to calculate # of hours based on date range and employee ID code
    By r0man3 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 09-02-2014, 08:04 PM
  5. [SOLVED] Formula to determine if a number fits in a range
    By hwishman in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-03-2014, 06:06 PM
  6. [SOLVED] INDEX date that MATCH on date range, MATCH code(string)
    By Dahlia in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2014, 03:33 AM
  7. VBA Code to extract records between a date range
    By Daveo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-21-2005, 04: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