+ Reply to Thread
Results 1 to 6 of 6

How to nest INDEX and Match into IF statements?

Hybrid View

  1. #1
    Registered User
    Join Date
    01-22-2014
    Location
    artic
    MS-Off Ver
    Excel 2003
    Posts
    5

    How to nest INDEX and Match into IF statements?

    Hi all,

    I have been reading through a couple of threads but cannot seem to wrap my head around adding IF to Index and Matching statements.

    What I want to do is to try to create a formula for the following,

    1. For all entries for x patient under CURRENT DATA, I want to look up the closest absolute value to 25% (under %max time)
    2. Then input the corresponding data in the same row into the cells on the NEW DATA side.

    For Example:


    file.png



    Looking at this, for Patient 2, closest value will be 27%, and the values in the other cells will be 2%, 92, 90 and 1 respectively.

    The if, match and index formula that I have always returns a false value.

    =IF(A3:A526=H5,(INDEX(C:C,MATCH(MIN(ABS(C:C-N1)),ABS(C:C-N1),0))),1)

    This is the formula I have tried. Could anyone help me out with this?

    Thank you.

    Regards
    Matthew

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: How to nest INDEX and Match into IF statements?

    Hi, welcome to the forum

    Please upload a sample of your workbook, not a picture of your data. Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    Also, not all members can upload picture files (Company firewalls and stuff) - and, depending on what browser is being used, some pics dont even show up on the forum

    Your workbook should show a small desensitized example of the data you are working with and a manual mockup of the expected results.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    01-22-2014
    Location
    artic
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: How to nest INDEX and Match into IF statements?

    Hi Ford,

    Thanks! Sorry about that. I didn't think of it.

    I've uploaded the sample!

    Cheers
    Matthew
    Attached Files Attached Files

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

    Re: How to nest INDEX and Match into IF statements?

    I used helpcells to get the result.

    See the yellow cells for the helpcells.

    See the green cells for the result.

    I used index / match after I added column A and C together in the current data.


    P.s. you don't added what value should be showing if the differance in absolut way is the same.
    Last edited by oeldere; 08-18-2015 at 03:13 AM. Reason: changed the layout
    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.

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    365 Version 2409
    Posts
    2,789

    Re: How to nest INDEX and Match into IF statements?

    Hi Matthew,

    I'm not a real formula guy, but I managed to come up with a solution. The efficiency of these formulas is probably low, but it was fun working them out. oeldere's are probably more efficient with the helper columns, but here you are.

    I ran these on your test sheet. They were written in cells I2:M2.
    I2, K2,L2 and M2 are all array formulas which means they must be entered with Control + Shift + Enter, not just Enter.
    The formula in J2 is just a regular formula, use Enter.

    I2:
    Formula: copy to clipboard
    =INDEX($C$3:$C$17,MATCH(MIN(ABS((IF($A$3:$A$17=H4,$C$3:$C$17,999)-$I$1))),ABS((IF($A$3:$A$17=H4,$C$3:$C$17-$I$1,999))),0))


    J2:
    Formula: copy to clipboard
    =ABS($I$1-$I4)


    K2:
    This formula can be copied into L2 and M2.
    Formula: copy to clipboard
    =INDEX(D$3:D$17,MATCH($H4 & "|" & $I4,$A$3:$A$17 & "|" & $C$3:$C$17,0))


    Good Luck.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-22-2014
    Location
    artic
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: How to nest INDEX and Match into IF statements?

    Thanks everyone, I'll give these a go and hopefully it turns out alright!

+ 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. [SOLVED] Nested If Statements or Match/Index???
    By djbcktt in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-10-2014, 12:57 AM
  2. Multiple If statements or INDEX MATCH? Im confused.
    By amedinak in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-20-2014, 05:08 AM
  3. [SOLVED] IF statements with nested INDEX MATCH
    By desertfx41 in forum Excel General
    Replies: 5
    Last Post: 07-08-2014, 03:26 PM
  4. HOW TO ? - Having issue with INDEX / Match and to nest with IF
    By icmpl in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-27-2013, 07:35 AM
  5. Using INDEX/MATCH With Multiple IF Statements
    By doraen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-17-2011, 04:10 PM
  6. Index Match - nested If (less than/greater than statements)
    By kelea in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 08-28-2009, 04:40 PM
  7. index/match lookup - with If statements
    By Algeraist in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-19-2008, 12:10 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