+ Reply to Thread
Results 1 to 6 of 6

Multiple If statements with multiple then statements pulling from Index/Match commands

Hybrid View

  1. #1
    Registered User
    Join Date
    11-07-2017
    Location
    Houston, TX
    MS-Off Ver
    2016
    Posts
    11

    Multiple If statements with multiple then statements pulling from Index/Match commands

    I am currently using Index/Match functions to pull data from two separate spreadsheets, however, I would like to combine or determine which spreadsheet (Index/Match function) to used based on the beginning character of the model #, such as "V", "N" or "T' as some examples.

    Currently Model Numbers, such as VXXX-XX-XX-XXXX-XXX pull from the following code...

    My code for "V" is

    =INDEX('M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!B$3:B$1053, MATCH(I$11, 'M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!$A$3:$A$1053,0))
    My code for "N" would be..

    =INDEX('[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!B$2:B$215,MATCH($B$23, '[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!$A$2:$A$215,0))
    Any help combining the searches into one command would be greatly appreciated.

    Thanks,
    Reg

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,921

    Re: Multiple If statements with multiple then statements pulling from Index/Match commands

    Something like this:
    =IF(left(model number,1)="V",INDEX('M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!B$3:B$1053, MATCH(I$11, 'M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!$A$3:$A$1053,0)),INDEX('[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!B$2:B$215,MATCH($B$23, '[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!$A$2:$A$215,0)))
    Post a workbook. How many types do you have?


    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to Quick Post button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Last edited by protonLeah; 11-29-2017 at 04:41 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    11-07-2017
    Location
    Houston, TX
    MS-Off Ver
    2016
    Posts
    11

    Re: Multiple If statements with multiple then statements pulling from Index/Match commands

    Where in the above modified statement would it direct to look the other index/match function for valves starting with "N"?

  4. #4
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,921

    Re: Multiple If statements with multiple then statements pulling from Index/Match commands

    In the IF() formula, it tests for "V", if "V" is found, the test returns TRUE, and the first Index function is evaluated/executed, if not, the second is. However, I suspect there are many more of these codes, so the IF statement may not work; thus the request for a workbook.

  5. #5
    Registered User
    Join Date
    11-07-2017
    Location
    Houston, TX
    MS-Off Ver
    2016
    Posts
    11

    Re: Multiple If statements with multiple then statements pulling from Index/Match commands

    Excellent. This works for the two (V & N) model #'s. But there is a third "P"

    So Code for V, N...is as follows

    =IF(LEFT(E15,1)="V",INDEX('M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!B$3:B$1053, MATCH(I$11, 'M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!$A$3:$A$1053,0)),INDEX('M:\Echart\[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!B$2:B$215,MATCH(I$11, 'M:\Echart\[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!$A$2:$A$215,0)))
    Code for P variable is...
    =INDEX('M:\Echart\[Echart 1048 Trim Code Sheet PSG Rev1.xls]Trim Codes'!B$7:B$16,MATCH(I$11, 'M:\Echart\[Echart 1048 Trim Code Sheet PSG Rev1.xls]Trim Codes'!$A$7:$A$16,0))
    If you need workbooks, I can send...just trying to combine three three worksheets into one.

    Thanks

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,921

    Re: Multiple If statements with multiple then statements pulling from Index/Match commands

    Testing for three criteria requires a 2-level nested if formula:
    =IF(LEFT(E15,1)="V",INDEX('M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!B$3:B$1053,MATCH(I$11,'M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!$A$3:$A$1053,0)),IF(LEFT(E15,1)="N",INDEX('M:\Echart\[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!B$2:B$215,MATCH(I$11,'M:\Echart\[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!$A$2:$A$215,0)),INDEX('M:\Echart\[Echart 1048 Trim Code Sheet PSG Rev1.xls]Trim Codes'!B$7:B$16,MATCH(I$11,'M:\Echart\[Echart 1048 Trim Code Sheet PSG Rev1.xls]Trim Codes'!$A$7:$A$16,0))))
    The first IF tests for V, and, if found, the first Index is evaluated. If V is not found, the inner IF tests for N, if N is found, the first Index of the inner IF function is evaluated, if not, then P is assumed and the last Index is evaluated.

    An alternative is the Choose function will branch to a specific Index function based on the position the test code (Left(E15,1)) is found in the lookup array:
    =CHOOSE(MATCH(LEFT(E15,1),{"V","N","P"},0),INDEX('M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!B$3:B$1053,MATCH(I$11,'M:\Echart\[EChart 1053 Trim Code Sheet Rev 19.xls]Trim Codes with MCS'!$A$3:$A$1053,0)),INDEX('M:\Echart\[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!B$2:B$215,MATCH(I$11,'M:\Echart\[EChart 1049 Oracle Trim Code Sheet Nextech.xlsx]Trim code with temps'!$A$2:$A$215,0)),value3)
    For instance if E15 is N... then Match(E15... returns 2 and Choose evaluates the second Index in the list.
    Last edited by protonLeah; 11-30-2017 at 03:29 PM.

+ 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. Pulling multiple data points from a file using VLookups and If statements
    By JTRiles in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-24-2017, 12:49 PM
  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. Index with multiple IF statements
    By Yves2509 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-26-2013, 01:53 AM
  4. Array formula - index and match with multiple statements
    By A[L]C in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 06-06-2013, 11:13 AM
  5. Multiple IF statements using an INDEX
    By AmandaJC77 in forum Excel General
    Replies: 0
    Last Post: 08-30-2011, 03:18 PM
  6. 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
  7. Replies: 12
    Last Post: 05-15-2009, 08:38 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