+ Reply to Thread
Results 1 to 10 of 10

MATCH + multiple arguments + OR function

  1. #1
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    MATCH + multiple arguments + OR function

    Hello everyone,

    I want to use the MATCH function to show the first result that meets 3 conditions in different arrays:
    - Condition 1: ARRAY1>0 (give cell positions in array with value greater than 0)
    - Condition 2: ARRAY2<10 (give cell positions in array with value lower than 10
    - Condition 3: ARRAY3=-2 OR ARRAY3=3 (give cell positions in array with value that equals -2 or 3)
    (condition 3: it should select the first TRUE argument of both that also corresponds to a TRUE in the arrays for condition 1 and 2, see example below)

    So I do something like this (simplified):
    =MATCH(1;(ARRAY1>0)*(ARRAY2<10)*(OR((ARRAY3=-2);(ARRAY2=-3));0)

    However, the formula gives a #VALUE error when it calculates the OR function for condition 3, the two separate parts are calculated correctly untill the formula has to actually perform the OR function.

    This is an example of a fictive dataset where the match function should return 3:
    ARRAY 1, condition 1 TRUE FALSE TRUE TRUE FALSE
    ARRAY 2, condition 2 TRUE TRUE TRUE FALSE TRUE
    ARRAY 3, condition 3 (first OR argument) FALSE FALSE TRUE TRUE FALSE
    ARRAY 3, condition 3 (second OR argument) FALSE TRUE FALSE TRUE FALSE

    Can anyone advise me on this? Thank you very much!

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,616

    Re: MATCH + multiple arguments + OR function

    Function OR do not work well with array applications, so may be try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    Re: MATCH + multiple arguments + OR function

    Hello Kaper,

    thank you so much for your help.
    It seems to work on a tryout sheet with a simple dataset

    But when I try it on my actual worksheet, it's still not giving the expected result.
    I attached a samplefile, the formula is entered in cell A4 in the testsheet (the result of this MATCH formula should be 1)

    I used the "Evaluate formula" tool to check out what's going on, but I can't find what's wrong.

    These are the steps prior to the error:
    error1.png
    error2.png
    error3.png

    Thank you for helping me!
    Attached Files Attached Files
    Last edited by Solvax; 08-17-2018 at 10:04 AM. Reason: Attachment

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,616

    Re: MATCH + multiple arguments + OR function

    Seems that two first conditions are checked with vertical array, while the "OR part" is in horizontal one. I'm writing on a smartphone now, so will not check myself, but is it like that?
    May be try TRANSPOSE (either transpose in a sheet or use inner function transpose) some of your tables to have all vertical or all horizontal (function MATCH needs 1D vector as second argument).

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: MATCH + multiple arguments + OR function

    As Kaper has said, the arrays in red are too wide - they can only be a single column wide:

    =MATCH(1,(('ARRAY1&2'!C10:C37>A2)*('ARRAY1&2'!B10:B37>B2)*((ARRAY3!I1:AJ1=C2)+(ARRAY3!I1:AJ1=D2))),0)

    I think you may need a SUMPRODUCT for this.
    Last edited by AliGW; 08-18-2018 at 03:09 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: MATCH + multiple arguments + OR function

    A bit of a guess, but see if this works for you:

    =COUNT(SUMPRODUCT((('ARRAY1&2'!C10:C37>A2)*('ARRAY1&2'!B10:B37>B2)*((ARRAY3!I1:AJ1=C2)+(ARRAY3!I1:AJ1=D2)))))

  7. #7
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: MATCH + multiple arguments + OR function

    Quote Originally Posted by Kaper View Post
    May be try TRANSPOSE (either transpose in a sheet or use inner function transpose) some of your tables to have all vertical or all horizontal (function MATCH needs 1D vector as second argument).
    As Kaper suggested, array confirmed

    =MATCH(1,((TRANSPOSE('ARRAY1&2'!C10:C37)>A2)*(TRANSPOSE('ARRAY1&2'!B10:B37)>B2)*((ARRAY3!I1:AJ1=C2)+(ARRAY3!I1:AJ1=D2))),0)

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer.

  8. #8
    Forum Contributor
    Join Date
    04-26-2017
    Location
    Brussels, Belgium
    MS-Off Ver
    2010
    Posts
    133

    Re: MATCH + multiple arguments + OR function

    Thank you everyone for your help. Much appreciated!
    I transposed the dataset from ARRAY3 and the problem is solved.

  9. #9
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,719

    Re: MATCH + multiple arguments + OR function

    Thanks for the rep!

  10. #10
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,616

    Re: MATCH + multiple arguments + OR function

    Thanks for marking thread SOLVED and for reputation point :-)

+ 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. Lookup function with multiple arguments
    By stephen.sutton in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-22-2017, 12:16 PM
  2. [SOLVED] How to add multiple arguments in a IF function
    By mdean32 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-27-2015, 05:09 PM
  3. IF Function Multiple Arguments
    By Stressed_Daniel in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 07-22-2015, 03:23 PM
  4. [SOLVED] Worksheetfunction.match arguments causing function to fail
    By icyrius in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-13-2013, 09:26 AM
  5. [SOLVED] Help with "You've entered too many arguments for this function" multiple INDEX(MATCH
    By BeachRock in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-29-2013, 06:10 PM
  6. [SOLVED] IF function with multiple arguments
    By myoung5149 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-11-2013, 06:01 AM
  7. Match Function arguments
    By Stan Altshuller in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-11-2005, 05:06 PM

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