How to Xlookup fuzzy match and standard Xlookup in the same formula?

Lacan

Board Regular
Joined
Oct 5, 2016
Messages
244
Office Version
  1. 365
Platform
  1. Windows
Hello Guys,👌

Would like to Xlookup fuzzy match and standard Xlookup in the same formula.
Through my daily agenda sometimes have to write a different hour before name of customer as you can see in table below cell D4.
Even though would like to match the sales goal of customer.
Can you please help with formula to both sides?
Thank you very much Guys. 👍👍🍻🍻

Fórmula Principal para o Ficheiro VDF.xlsm
ABCDEFGHIJKL
1
2
3HORACUSTOMERSALES GOALCUSTOMERSALES GOAL
409:0009H30 JOHN DELINAJOHN3000
510:00HANNA250ELISARICKY4000
611:00ELISA900HANNASARAH6500
712:00PETER4500JACKHANNA250
813:00 JOHNELISA900
914:00 MARIADELINA1000
1015:00 PETERPETER4500
1116:00 RICKYJACK7000
1217:00 SARAHMARIA6020
1318:00 
1419:00 
15
16
Folha13
Cell Formulas
RangeFormula
H4:H14H4=SORT(Tabela8[CUSTOMER])
E4:E14E4=IFERROR(XLOOKUP(D4,Tabela8[CUSTOMER],Tabela8[SALES GOAL],0,0),"")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
D4:D14List=$H$4#
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Try:
Excel Formula:
=SUM(IF(ISNUMBER(SEARCH(Tabela8[CUSTOMER],D4)),Tabela8[SALES GOAL],0))
 
Upvote 0
Try:
Excel Formula:
=SUM(IF(ISNUMBER(SEARCH(Tabela8[CUSTOMER],D4)),Tabela8[SALES GOAL],0))
That would fail if a shorter name in Tabela8 occurs within a longer customer name in col D, as in my sample data.


@Lacan
If all the names really are single words like your sample then try this. No need to copy down.

25 01 20.xlsm
DEFGHIJ
1
2
3CUSTOMERSALES GOALCUSTOMERSALES GOAL
409H30 JOHN3000JOHN3000
5HANNA250RICKY4000
6ANNELISASARAH6500
7PETER4500HANNA250
8ELISA900
9DELINA1000
10ELISA900PETER4500
11JACK7000
12MARIA6020
13
14
15
16
XLOOKUP
Cell Formulas
RangeFormula
E4:E15E4=XLOOKUP(TEXTAFTER(D4:D15," ",,,,D4:D15),Tabela8[CUSTOMER],Tabela8[SALES GOAL],"")
Dynamic array formulas.



If the names could be more than one word then perhaps this (but fix the table name). Again, no need to copy down.

25 01 20.xlsm
DEFGHIJ
1
2
3CUSTOMERSALES GOALCUSTOMERSALES GOAL
409H30 JOHN3000JOHN3000
5HANNA250RICKY4000
6ELISA HALL900SARAH6500
7PETER4500HANNA250
8ANNELISA HALLELISA HALL900
910H15 JACK BLACK7000DELINA1000
10PETER4500
11JACK BLACK7000
12MARIA6020
13
14
15
16
XLOOKUP (2)
Cell Formulas
RangeFormula
E4:E15E4=XLOOKUP(IF(ISNUMBER(-LEFT(D4:D15,1)),TEXTAFTER(D4:D15," "),D4:D15),Tabela84[CUSTOMER],Tabela84[SALES GOAL],"")
Dynamic array formulas.
 
Upvote 0
If you have access to the new REGEX functions and the time has the same format maybe you could try something like:

Excel Formula:
=XLOOKUP(REGEXREPLACE(D4:D14,"\d{2}.\d{2}\s","",,1),Tabela8[CUSTOMER],Tabela8[SALES GOAL])
 
Upvote 0
If you have access to the new REGEX functions and the time has the same format maybe you could try something like:

Excel Formula:
=XLOOKUP(REGEXREPLACE(D4:D14,"\d{2}.\d{2}\s","",,1),Tabela8[CUSTOMER],Tabela8[SALES GOAL])
Good thought, though I'm not sure how widely available the function is yet. Two comments:
  • It probably needs the "if not found" option in XLOOKUP to deal with the blank rows in the OP's data
  • Given the sample data the pattern could probably be reduced?
Excel Formula:
=XLOOKUP(REGEXREPLACE(D4:D14,".*\d ","",,1),Tabela8[CUSTOMER],Tabela8[SALES GOAL],"")

.. or if it is possible there are no minutes in the time and so there might be an entry like "11H JOHN" then perhaps
Excel Formula:
=XLOOKUP(REGEXREPLACE(D4:D14,"\d.+? ","",,1),Tabela8[CUSTOMER],Tabela8[SALES GOAL],"")
 
Upvote 0
Solution
Many thanks @Peter_SSs for the adjustments - I am still trying learning REGEX so there is a high chance that there will be a more effective pattern.
 
Upvote 0
My Dears @Cubist @Peter_SSs and @hagia_sofia

Thank you very much Guys!!!
Excel Formula:
=XLOOKUP(REGEXREPLACE(D4:D14,"\d.+? ","",,1),Tabela8[CUSTOMER],Tabela8[SALES GOAL],"")
works very Beatiful because have also no single names and because it matches your advance entry thoughts the formula fits very well.
So far so good.
Lets supposse that could have also text after Name. Is formula would be long?
Very Grateful!!! 🔝🔝👍👍🍻🍻🍻

Fórmula Principal para o Ficheiro VDF.xlsm
ABCDEFGHIJK
1
2
3HORACUSTOMERSALES GOALCUSTOMERSALES GOAL
409:00JACK DE WALL TEST IT DELINAJOHN3000
510:00HANNA250ELISARICKY4000
611:00ELISA900HANNASARAH6500
712:0010H00 PETER4500JACK DE WALLHANNA250
813:00 JOHNELISA900
914:00 MARIADELINA1000
1015:00 PETERPETER4500
1116:00 RICKYJACK DE WALL7000
1217:00 SARAHMARIA6020
1318:00 
1419:00 
15
16
Folha13
Cell Formulas
RangeFormula
H4:H14H4=SORT(Tabela8[CUSTOMER])
E4:E14E4=XLOOKUP(REGEXREPLACE(D4,"\d.+? ","",,1),Tabela8[CUSTOMER],Tabela8[SALES GOAL],"")
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
D4:D14List=$H$4#
 
Upvote 0
Thank you very much for clarifying!
If you put some identifying character before the extra text (eg I have used a colon) then you could use something like this
You would have to adjust the table name in the formula.

Lacan.xlsm
CDEFIJ
3HORACUSTOMERSALES GOALCUSTOMERSALES GOAL
40.375JACK DE WALL : TEST IT7000JOHN3000
50.416666667HANNA250RICKY4000
60.458333333ELISA900SARAH6500
70.510H00 PETER4500HANNA250
80.541666667 ELISA900
90.583333333 DELINA1000
100.625 PETER4500
110.666666667 JACK DE WALL7000
120.708333333 MARIA6020
130.75 
140.791666667 
Sheet2
Cell Formulas
RangeFormula
E4:E14E4=XLOOKUP(REGEXREPLACE(TRIM(TEXTBEFORE(D4&":",":")),"\d.+? ","",,1),Table1[CUSTOMER],Table1[SALES GOAL],"")
 
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,728
Members
453,368
Latest member
positivemind

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top