Jul 15 2022 01:59 AM
Hi,
I am looking to create a lookup function for a large datasheet probably 120k rows and 10 columns (roughly).
I am looking to lookup using an order number or a drawing number. Sometimes we use the drawing number to find the order number and vice versa.
The order number consists of 6-10 consecutive digits without spaces. (so this is not a problem)
Drawing numbers consist of 8 digits, a space and a hyphen and number.
examples:
12345678 (this is how we would type the value in)
1234 5678
1234 5678-0
1234 5678-1
1234 5678-2... etc
We usually write the drawing numbers like the first example in the list, but it could be registered in any way I've shown above and the last digit behind the hyphen is not always known.
How should I tackle this issue? Is it possible to do with vlookup, or is it a lot more complex than what this function can do?
Any suggestions are much appreciated!
Thanks
Jul 15 2022 02:15 AM - edited Jul 15 2022 02:16 AM
Solution@cleach86 Perhaps like in the attached file. The formula used is:
=XLOOKUP(D2,VALUE(LEFT(SUBSTITUTE(DrawingNrs," ",""),8)),OrderNrs,"Not found")
where DrawingNrs and OrderNrs are named ranges.
Cannot predict, though, how this will perform on 120K rows,
Jul 15 2022 02:30 AM
Jul 15 2022 04:03 AM
Jul 15 2022 04:19 AM
@cleach86 XLOOKUP, similar to VLOOKUP returns only the first match it finds.
Since you are using Office 365 you can use FILTER to return all matches to one or multiple criteria. Not sure though how exactly that could be implemented with your specific data.
Jul 19 2022 12:23 AM
Thank you very much for your input, it is appreciated.
I have got the filter function to work using the serial number and it is returning the values that I want it to show. However, this was the easy part though...
Is it possible to use the filter function using "jokers", so let's say that "*" is the joker.
Can I then use the filter function using 1234*5678* to return all the values containing these 8 digits in this order, eventhough they might contain a space or a hyphenation.
I hope you know what I mean.
Jul 19 2022 02:00 AM
I believe you meant "wildcard" when you said "joker" (do you speak Portuguese?).
Unfortunately, FILTER does not accept wildcards. You'll have to incorporate LEFT and SUBSTITUTE like in Riny_van_Eekelen first response. This will look something like this:
Jul 19 2022 02:13 AM - edited Jul 19 2022 02:16 AM
@cleach86 Unlike XLOOKUP, I don't think you can use of wildcards inside the FILTER function. But I may be mistaken.
However, you could filter for each of the two segments with ISNUMBER and FIND. Such a formula would then look something like this (in the file I attached you earlier).
=FILTER(B4:B8,ISNUMBER(FIND("1234",A4:A8)+FIND("5678",A4:A8,5)))
Jul 19 2022 02:56 AM
You could exploit the wildcard capability of either COUNTIFS or SEARCH to identify the records to retain. SEARCH (or FIND) is more straightforward.
= FILTER(Table, ISNUMBER(SEARCH(findText,DrawingNrs)))
Jul 19 2022 03:42 AM
This is the more complicated approach that uses COUNTIFS to return 1 or 0 for each DrawingNr. I have used Currying to pass the 'text to find' and the 'text to be searched' separately.
Worsheet Formula
= FILTER(Table,
MAP(DrawingNrs, SearchForλ(findText))
)
SearchForλ
= LAMBDA(find,
LAMBDA(searchText,
COUNTIFS(searchText, find)
)
);
Perhaps "less straightforward" understates the challenge?
Jul 19 2022 04:00 AM