+ Reply to Thread
Results 1 to 4 of 4

XLookup returning wrong values when using two conditions

  1. #1
    Registered User
    Join Date
    04-03-2020
    Location
    Germany
    MS-Off Ver
    Microsoft 365
    Posts
    2

    XLookup returning wrong values when using two conditions

    Hi,

    with this beeing my first post, be gentle with me I did not find this anywhere, so hopefully its a new problem to you.

    When using the new xlookup with two conditions and match_mode =1 (exact match or next larger) (did not test with other match modes) the formula will sometimes return wrong values.

    Please take a look at the attached file and tell me what I'm doing wrong :/
    First I created a xlookup with only one condition, the results are correct.
    Next I created a xlookup with two conditions and marked the wrong results.
    Attached Files Attached Files

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: XLookup returning wrong values when using two conditions

    Please try at C7

    =XLOOKUP(--(C5&C6);--($C$12:$C$27&$A$12:$A$27);$B$12:$B$27;0;1;1)

    or
    =XLOOKUP(TEXT(C5&C6;"00000");TEXT($C$12:$C$27&$A$12:$A$27;"00000");$B$12:$B$27;0;1;1)




    Text compare value from left to right , don't see digit
    "5" > "49" > "399" > "2999" > "1"

    while number sort by value
    2999 > 399 > 49 > 5 > 1

    You may try
    =SORT($C$12:$C$27&$A$12:$A$27) VS =SORT(--($C$12:$C$27&$A$12:$A$27))
    to see how Text and number are
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-03-2020
    Location
    Germany
    MS-Off Ver
    Microsoft 365
    Posts
    2

    Re: XLookup returning wrong values when using two conditions

    Thank you. Worked perfectly.

    I dont understand the problem though. Why are the cells read as text when they are formatted as numbers? I would have guessed the problem myself if I would have known :p

  4. #4
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,211

    Re: XLookup returning wrong values when using two conditions

    Text related function or ampersand & change number to text
    eg;

    =1&2 ="12"
    =trim(1) ="1"

+ 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. Index Match returning wrong values
    By CoachK88 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-03-2018, 12:48 AM
  2. [SOLVED] Index Match function returning wrong values sometimes
    By Dord25 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-19-2018, 09:18 PM
  3. [SOLVED] VLOOKUP Returning Wrong Values
    By happymonody in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-17-2015, 04:40 AM
  4. Returning Values of Different Cells Depending on Conditions
    By laffers in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2010, 10:19 AM
  5. WeekdayName returning wrong values
    By Newbie_Nick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-02-2009, 02:15 AM
  6. Replies: 2
    Last Post: 05-24-2006, 05:35 PM
  7. returning values from columns to another sheet, based on conditions
    By zangief in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2005, 04:05 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