+ Reply to Thread
Results 1 to 5 of 5

XLOOKUP issue returning an array

  1. #1
    Registered User
    Join Date
    07-28-2024
    Location
    Texas
    MS-Off Ver
    365
    Posts
    2

    Question XLOOKUP issue returning an array

    Hi everyone!

    I think what I'm trying to do is relatively simple but I can seem to figure out what's going on. I'm trying us XLOOKUP to return an array using the following:

    =XLOOKUP(A1,sheet2!A5:Z5,sheet2!A6:Z150)

    It works as intended as long as the lookup value in A1 is hard coded, but as soon as I change it to the formula I need it to be(=B1-1), I get an #N/A error. The formula returns the same value, but for some reason XLOOKUP now can't find it in the lookup array?

    Maybe I'm wrong but I don't think I'm attempting anything crazy here. The lookup array and return array are all static values and the lookup value is a single or two-digit integer.

    What am I missing?

    Thanks in advance!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,989

    Re: XLOOKUP issue returning an array

    Welcome to the forum.

    Check that your numbers are real numbers and not text.

    There are instructions at the top of the page explaining how to attach your sample workbook (yellow banner: HOW TO ATTACH YOUR SAMPLE WORKBOOK). Screenshots are of little practical use as we cannot manipulate them.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-28-2024
    Location
    Texas
    MS-Off Ver
    365
    Posts
    2

    Re: XLOOKUP issue returning an array

    Thanks for the reply, Ali! Embarrassingly, I can't seem to replicate this behavior in a fresh workbook. Does that indicate anything?

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,787

    Re: XLOOKUP issue returning an array

    Possibly down to floating point arithmetic https://learn.microsoft.com/en-us/of...ccurate-result

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,454

    Re: XLOOKUP issue returning an array

    Depends, maybe, on how cell A1 is/was formatted, what you manually typed in, and what's in B1. Guessing that if you had text in B1 and you tried to subtract 1, you'd get #VALUE! On the other hand, if the lookup range is text, and the search value was text (A1) it should work. But, if the lookup range is text, and B1-1 produces a numeric value, it won't work even if it looks as though it should.

    Starting in a new book, all the cells would be formatted as General, so that might make a difference.

    We need to see the book that demonstrates the issue for a definitive answer.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. XLOOKUP returning #N/A error
    By raselacca0 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-28-2024, 11:44 AM
  2. xlookup - returning N/A
    By jozoo in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-08-2023, 06:06 AM
  3. Help with XLOOKUP returning multiple values
    By Schuck in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-16-2022, 06:21 AM
  4. Xlookup returning value based on date
    By nmarcon in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-28-2022, 02:16 AM
  5. [SOLVED] xlookup not returning value due to looking up dates
    By dharvey1978 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-08-2022, 03:11 AM
  6. XLOOKUP not finding/returning matches on X & Y axis.
    By JamesParkerDC in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2022, 12:13 PM
  7. [SOLVED] XLookup returning wrong values when using two conditions
    By Einrastor in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-03-2020, 07: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