+ Reply to Thread
Results 1 to 12 of 12

Nested IF Statement with INDEX and MATCH

  1. #1
    Registered User
    Join Date
    07-16-2012
    Location
    Utah
    MS-Off Ver
    365 ver. 2210
    Posts
    34

    Nested IF Statement with INDEX and MATCH

    HI I am having a problem figuring something out, if someone could help I would appreciate it.

    I have three worksheets the first one called Econ the second one called CheckLogs and the third is a customer sheet. I am needing to match up a cell from the Econ sheet with a cell from the Checklogs sheet and then it matches a cell from the customer sheet with a cell from the checklogs to determine what customer sheet. My problem is how do I loop through the customer code cell until it finds the correct cell.

    =IF(B1=CheckLogs!B2,INDEX(CheckLogs!$F$2:$F$4493,MATCH(Econ!G2,CheckLogs!$C$2:$C$4493,0),MATCH($B$1,CheckLogs!$B2:B4493,0)), "")

    so in the formula "B1" is located on the customer sheet and is the customer code field, "CheckLogs!B2" is on the CheckLogs sheet and is the customer code field. I'm just not sure how you loop if the customer code in B1 doesn't equal the customer code in CheckLogs!B2 and run through the formula again.

    Sorry if this doesn't make sense.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,803

    Re: Nested IF Statement with INDEX and MATCH

    It might help if you attach a sample workbook.

    Pete

  3. #3
    Registered User
    Join Date
    05-22-2014
    Posts
    6

    Re: Nested IF Statement with INDEX and MATCH

    Hi,

    I have one worksheet. I am needing to match up column G with value on $E$3 and give consecutive numbers on column F depending if the matched column G with value on $E$3 is on same date of column L; I have plenty blankcells and other values on column G.
    I trying catch up
    Thanks 4 your help
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-16-2012
    Location
    Utah
    MS-Off Ver
    365 ver. 2210
    Posts
    34

    Re: Nested IF Statement with INDEX and MATCH

    Sorry about that here is a sample Workbook
    Attached Files Attached Files

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Nested IF Statement with INDEX and MATCH

    As I understand the problem, this should solve it.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Registered User
    Join Date
    07-16-2012
    Location
    Utah
    MS-Off Ver
    365 ver. 2210
    Posts
    34

    Re: Nested IF Statement with INDEX and MATCH

    @newdoverman Thank you so much worked perfectly. I know I didn't explain it very well and you totally nailed it for me. Thank you again

  7. #7
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Nested IF Statement with INDEX and MATCH

    You're welcome. I'm glad that it worked out for you.

  8. #8
    Registered User
    Join Date
    07-16-2012
    Location
    Utah
    MS-Off Ver
    365 ver. 2210
    Posts
    34

    Re: Nested IF Statement with INDEX and MATCH

    @newdoverman if you don't mind could you give me a quick explaination of the formula you used to make this work. I just want to make sure I understand what it's doing.

    =IFERROR(INDEX(Econ!C$2:C$4500,SMALL(IF(Econ!$I$2:$I$4500=$B$1,ROW(Econ!$I$2:$I$4500)-MIN(ROW(Econ!$I$2:$I$4500))+1),ROWS($1:1))),"")

  9. #9
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Nested IF Statement with INDEX and MATCH

    Starting in the middle of the formula, this is roughly how this goes:

    The IF statement starts off with Econ!$I$2:$I$100=$B$1. This searches Econ!$I2:$I100 for cells that equal B1 which is 1USC. This returns a list in order giving TRUE for every cell that matches and FALSE for every cell that doesn't match.

    ROW(Econ!$I$2:$I$100)-MIN(ROW(Econ!$I$2:$I$100))+1 is the value for TRUE of the IF statement. Gives a listing of all the rows in the range $I$2:$I$100. This is a listing of 1 to 99. There isn't a value for FALSE given.
    The IF statement is surrounded by a SMALL statement SMALL(IF(Econ!$I$2:$I$100=$B$1,ROW(Econ!$I$2:$I$100)-MIN(ROW(Econ!$I$2:$I$100))+1),ROWS($1:1)) The SMALL statement has two parts, the ARRAY and the K.

    The array part is IF(Econ!$I$2:$I$100=$B$1,ROW(Econ!$I$2:$I$100)-MIN(ROW(Econ!$I$2:$I$100))+1) This returns a FALSE for cells that don't have 1USC and row numbers for cells that do have 1USC which is the value in B1.

    The K part of the SMALL function arguments is ROWS($1:1) is a counter that increments by 1 every time the array part of the SMALL function returns a number. This allows the formula to return the row number where the values sought are in the order in which they are found.

    INDEX surrounds all of the above and identifies from where the values sought are to be found. In this case the values are in Econ!A$2:A$100 using the rows determined from the above SMALL(IF.... part of the formula.

    IFERROR surrounds the whole formula above and if the result is an error it returns the value between the "" at the end of the formula.

    I hope that this is understandable.

  10. #10
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Nested IF Statement with INDEX and MATCH

    Starting in the middle of the formula, this is roughly how this goes:

    The IF statement starts off with Econ!$I$2:$I$100=$B$1. This searches Econ!$I2:$I100 for cells that equal B1 which is 1USC. This returns a list in order giving TRUE for every cell that matches and FALSE for every cell that doesn't match.

    ROW(Econ!$I$2:$I$100)-MIN(ROW(Econ!$I$2:$I$100))+1 is the value for TRUE of the IF statement. Gives a listing of all the rows in the range $I$2:$I$100. This is a listing of 1 to 99. There isn't a value for FALSE given.
    The IF statement is surrounded by a SMALL statement SMALL(IF(Econ!$I$2:$I$100=$B$1,ROW(Econ!$I$2:$I$100)-MIN(ROW(Econ!$I$2:$I$100))+1),ROWS($1:1)) The SMALL statement has two parts, the ARRAY and the K.

    The array part is IF(Econ!$I$2:$I$100=$B$1,ROW(Econ!$I$2:$I$100)-MIN(ROW(Econ!$I$2:$I$100))+1) This returns a FALSE for cells that don't have 1USC and row numbers for cells that do have 1USC which is the value in B1.

    The K part of the SMALL function arguments is ROWS($1:1) is a counter that increments by 1 every time the array part of the SMALL function returns a number. This allows the formula to return the row number where the values sought are in the order in which they are found.

    INDEX surrounds all of the above and identifies from where the values sought are to be found. In this case the values are in Econ!A$2:A$100 using the rows determined from the above SMALL(IF.... part of the formula.

    IFERROR surrounds the whole formula above and if the result is an error it returns the value between the "" at the end of the formula.

    The above is ARRAY ENTERED (Ctrl + Shift + Enter) because it is calculating ranges of cells with other ranges of cells and there is no function overriding the requirement for an array formula. SUMPRODUCT is an example of a function that does array type calculations without requiring ARRAY entry. That condition isn't present in this formula.
    I hope that this is understandable.

  11. #11
    Registered User
    Join Date
    07-16-2012
    Location
    Utah
    MS-Off Ver
    365 ver. 2210
    Posts
    34

    Re: Nested IF Statement with INDEX and MATCH

    Yes makes sense and thank you for your time to explain. Thank you again

  12. #12
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Nested IF Statement with INDEX and MATCH

    You're welcome.

    Thank you for the feedback.

+ 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] 3 Nested IF INDEX MATCH
    By JonesZoid in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-09-2014, 10:56 AM
  2. [SOLVED] Combining Nested IF statement with Index/Match??
    By consulttk in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-21-2012, 09:48 AM
  3. nested if statement with index and match within
    By darkowen in forum Excel General
    Replies: 3
    Last Post: 02-01-2012, 02:02 AM
  4. Nested Match(index()) vs. Match() array formula.
    By GeneralDisarray in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-14-2011, 07:57 AM
  5. Nested IF (index and match)
    By mikera in forum Excel General
    Replies: 2
    Last Post: 01-21-2010, 11:27 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