Feb 07 2020 03:39 PM
I have a column consisting of part numbers: a mix of numbers and digit/letter combos, e.g
2, 3, 3a, 4, 5, 6, 6a, 6b, 6c, 7, 8 ......
I have formatted both the source column and the lookup column as text. But xlookup() only finds the cells which have both digits and letters (i.e. 3a, 6a, 6b, 6c...)
Feb 08 2020 03:25 AM - edited Feb 08 2020 03:28 AM
I suspect that in one column your data was entered as numbers and text and then you formatted the columns as text. Numbers are left-justified but they are still numbers. Your other column probably consists of "real" text. Note that, when you first format the column as text and then enter data, all entries will become text. Check the nature of your data by entering =ISNUMBER(cell). TRUE means that it is a number, FALSE means that it is not. This is demonstrated in the attached file, though I used VLOOKUP as it will have the same effect.
Feb 08 2020 05:18 AM
To avoid misformatting you could use something like
=XLOOKUP(TEXT(<value>,"General"),TEXT(<lookup array>,"General"),<return array>)
Feb 08 2020 09:13 AM
Thanks for the replies.
I have since found a solution elsewhere; I used the 'Text to Columns' control on the column causing the problems. Apparently this is a common issue when importing columns from other sheets.
Feb 08 2020 09:23 AM
So far so good. In Text to Columns, and not only, it's always better to define data type. If by default Excel makes some guess, but not always correct one.
Apr 27 2020 07:55 AM
@SergeiBaklan That's a terrific solution Sergei! I was having a similar problem with numerical product number with leading zeroes! Using TEXT to define the values as "General" has solved a longterm headache. Thank you.
Matthew
Apr 29 2020 05:16 AM
Feb 08 2023 08:43 AM
@Riny_van_Eekelen thanks for the explanation, which format are we trying to achieve to make it work? I use text to columns on every column, still getting the N/A when I use the formula though. When I use the =ISNUMBER(cell) I get TRUE on most columns, FALSE on one column, and don't know which one is correct.
Feb 08 2023 10:37 PM
@BCURRIE2240 Not sure that I understand how your question relates to this (rather old) thread.
Perhaps better to start a new and provide some screenshots or share a file, clarifying what you need.
May 17 2023 11:13 AM
May 22 2023 02:32 AM
XLOOKUP itself is not dramatically slower than INDEX/MATCH or VLOOKUP in same scenarios. Depends on how do you use them, perhaps something else. If you could reproduce the case on sample file with removed sensitive data, it's better to discuss having such sample.
Sep 29 2023 05:47 AM
Hello sir
About the code you provided, can you explain what "TEXT" does?
Maybe you can put in a little example
=XLOOKUP(TEXT(<value>,"General"),TEXT(<lookup array>,"General"),<return array>)
Sep 29 2023 07:11 AM
Having mix of texts and numbers it's more reliable to use only texts. TEXT(value, "General") or TEXT(value, "@") converts number to text and keeps text as it is. For example
Please check the same in attached file.