Home
%3CLINGO-SUB%20id%3D%22lingo-sub-873222%22%20slang%3D%22en-US%22%3EFuzzy%20Matching%20in%20Power%20Query%20for%20Microsoft%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-873222%22%20slang%3D%22en-US%22%3E%3CP%3EImagine%20this.%26nbsp%3BWe%20have%20been%20given%20a%20list%20of%20products%20from%20company%20A%20and%20a%20list%20of%20products%20from%20company%20B.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOur%20job%20is%20to%20match%20products%20between%20the%20two%20lists.%20But%20each%20company%20might%20have%20slightly%20different%20names%20for%20the%20same%20item.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20means%20we%20can't%20just%20use%20a%20lookup%20function%20because%20we%20don't%20have%20exact%20matches.%20We%20can't%20even%20use%20wildcards%20in%20a%20lookup%20function%20because%20the%20product%20names%20aren't%20different%20in%20a%20predictable%20way.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20is%20where%20we%20realize%20we%20have%20to%20manually%20match%20our%20products%20from%20the%20two%20lists%20and%20eventually%20we%20give%20up%20and%20start%20to%20cry!%20Right%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENo%2C%20because%20we%20now%20have%20a%20fuzzy%20match%20option%20in%20Power%20Query.%20Lazy%20people%20rejoice!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENot%20sure%20what%20Power%20Query%20is%3F%20Then%20check%20out%20this%20%3CA%20href%3D%22https%3A%2F%2Fwww.howtoexcel.org%2Fpower-query%2Fthe-complete-guide-to-power-query%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EIntroduction%20to%20Power%20Query%3C%2FA%3E%20beforehand.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1844989271%22%20id%3D%22toc-hId-1844989271%22%20id%3D%22toc-hId-1844989271%22%20id%3D%22toc-hId-1844989271%22%3EExample%3C%2FH2%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20485px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133356iD30E0F5CB75F9636%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2201%20List%20of%20Products.png%22%20title%3D%2201%20List%20of%20Products.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20our%20example%2C%20we%20have%20List%20A%20and%20List%20B.%20These%20are%20small%20and%20only%20have%20the%20one%20column%2C%20but%20imagine%20we're%20working%20with%20two%20large%20datasets%20with%20hundreds%20or%20thousands%20or%20products%20and%20many%20other%20columns.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20can%20see%20that%20none%20of%20the%20items%20in%20each%20list%20is%20an%20exact%20match%2C%20but%20they%20are%20likely%20the%20same%20product.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20example%2C%20in%20list%20A%20we%20have%20%22Macaroni%20and%20cheese%22%2C%20but%20in%20list%20B%20we%20have%20%22Macaroni%20%26amp%3B%20Cheese%22.%20They%20are%20the%20same%20thing%20but%20slightly%20different.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--707167690%22%20id%3D%22toc-hId--707167690%22%20id%3D%22toc-hId--707167690%22%20id%3D%22toc-hId--707167690%22%3ECreate%20A%20Query%20For%20Both%20Tables%3C%2FH2%3E%0A%3CP%3EBoth%20these%20lists%20have%20been%20converted%20into%20%3CA%20href%3D%22https%3A%2F%2Fwww.howtoexcel.org%2Ftutorials%2Feverything-you-need-to-know-about-excel-tables%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EExcel%20Tables%3C%2FA%3E%20named%20%3CSTRONG%3EListA%3C%2FSTRONG%3E%20and%20%3CSTRONG%3EListB%3C%2FSTRONG%3E.%20The%20first%20thing%20we%20will%20need%20to%20do%20is%20create%20a%20query%20for%20each%20table.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%20a%20cell%20inside%20the%20table.%3C%2FLI%3E%0A%3CLI%3EGo%20to%20the%20%3CSTRONG%3EData%3C%2FSTRONG%3E%20tab.%3C%2FLI%3E%0A%3CLI%3EUse%20the%20%3CSTRONG%3EFrom%20Table%2FRange%3C%2FSTRONG%3E%20query%20command.%3C%2FLI%3E%0A%3CLI%3EGo%20to%20the%20%3CSTRONG%3EHome%3C%2FSTRONG%3E%20tab%20in%20the%20Power%20Query%20editor.%3C%2FLI%3E%0A%3CLI%3ESelect%20%3CSTRONG%3EClose%20%26amp%3B%20Load%3C%2FSTRONG%3E%26nbsp%3B%E2%9E%9C%20%3CSTRONG%3EClose%20%26amp%3B%20Load%20To%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3EChoose%20%3CSTRONG%3EOnly%20Create%20Connection%3C%2FSTRONG%3E%20from%20the%20Import%20Data%20menu.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EOnce%20this%20is%20done%20for%20both%20tables%2C%20we'll%20be%20able%20to%20merge%20(join)%20the%20tables%20in%20another%20query.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1035642645%22%20id%3D%22toc-hId-1035642645%22%20id%3D%22toc-hId-1035642645%22%20id%3D%22toc-hId-1035642645%22%3ECreate%20A%20Merge%20Query%20Using%20Both%20Tables%3C%2FH2%3E%0A%3CP%3EPower%20Query%20has%20an%20option%20to%20merge%20tables.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20allows%20us%20to%20join%20data%20in%20two%20tables%20based%20on%20a%20common%20field%20like%20an%20ID%20column%2C%20or%20in%20our%20case%20the%20%3CSTRONG%3EProduct%3C%2FSTRONG%3E%20name%20column.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20is%20where%20we'll%20also%20find%20the%20new%20fuzzy%20match%20feature.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20549px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133357i7C3C44344401C6BE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2202%20Merge%20Queries.png%22%20title%3D%2202%20Merge%20Queries.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreate%20a%20Merge%20query.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EGo%20to%20the%20%3CSTRONG%3EData%3C%2FSTRONG%3E%20tab.%3C%2FLI%3E%0A%3CLI%3EChoose%20%3CSTRONG%3EGet%20Data%3C%2FSTRONG%3E%26nbsp%3Bfrom%20the%20ribbon.%3C%2FLI%3E%0A%3CLI%3EChoose%20%3CSTRONG%3ECombine%20Queries%3C%2FSTRONG%3E%26nbsp%3Bfrom%20the%20menu.%3C%2FLI%3E%0A%3CLI%3EChoose%20%3CSTRONG%3EMerge%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThis%20will%20open%20up%20the%20Merge%20query%20menu.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1516514316%22%20id%3D%22toc-hId--1516514316%22%20id%3D%22toc-hId--1516514316%22%20id%3D%22toc-hId--1516514316%22%3EMerge%20Menu%20Settings%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20700px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133358i8382254114E1C67D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2203%20Merge%20Menu.png%22%20title%3D%2203%20Merge%20Menu.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20Merge%20menu%20is%20where%20we%20can%20enable%20fuzzy%20matching.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3ESelect%20the%20first%20query%20we%20want%20to%20merge.%20For%20us%2C%20this%20will%20be%20%3CSTRONG%3EListA%3C%2FSTRONG%3E.%20We%20also%20need%20to%20select%20the%20column%20to%20base%20the%20merge%20on%2C%20for%20us%20this%20is%20the%20%3CSTRONG%3EProduct%3C%2FSTRONG%3E%20name%20column.%3C%2FLI%3E%0A%3CLI%3ESelect%20the%20second%20query%20we%20want%20to%20merge%20and%20the%20column%20to%20base%20the%20merge%20on.%3C%2FLI%3E%0A%3CLI%3EWe%20also%20need%20to%20select%20what%20type%20of%20join%20to%20perform.%20There%20are%20several%20choice%2C%20but%20we'll%20stick%20with%20the%20default%20option%20to%20return%20all%20items%20from%20the%20first%20list%20and%20only%20matching%20items%20from%20the%20second%20list.%20This%20is%20also%20where%20we%20can%20select%20fuzzy%20matching%20as%20an%20option%2C%20check%20the%20%3CSTRONG%3EUse%20fuzzy%20matching%20to%20perform%20the%20merge%3C%2FSTRONG%3E%20box.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ENotice%20at%20the%20bottom%20of%20the%20merge%20menu%2C%20Power%20Query%20tells%20us%20how%20many%20matches%20are%20found.%20When%20we%20enable%20fuzzy%20matches%2C%20this%20goes%20from%20%3CSTRONG%3E0%20of%208%3C%2FSTRONG%3E%20to%20%3CSTRONG%3E2%20of%208%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-226296019%22%20id%3D%22toc-hId-226296019%22%20id%3D%22toc-hId-226296019%22%20id%3D%22toc-hId-226296019%22%3EFuzzy%20Matching%20Options%3C%2FH2%3E%0A%3CP%3EWe've%20already%20improved%20our%20matching%20by%20just%20enabling%20the%20fuzzy%20matching%20option.%20But%20there%20are%20more%20settings%20we%20can%20use%20to%20help%20improve%20the%20matching.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20699px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133359i03B0B08F42B3D84F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2204%20Fuzzy%20Matching%20Options.png%22%20title%3D%2204%20Fuzzy%20Matching%20Options.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EClick%20on%20the%20collapsed%20%3CSTRONG%3EFuzzy%20matching%20options%3C%2FSTRONG%3E%20and%20more%20advanced%20settings%20will%20be%20revealed.%20These%20can%20help%20us%20match%20more%20items%20in%20our%20lists.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1772592849%22%20id%3D%22toc-hId-1772592849%22%20id%3D%22toc-hId-1772592849%22%20id%3D%22toc-hId-1772592849%22%3ESimilarity%20Threshold%3C%2FH3%3E%0A%3CP%3EThere's%20a%20similarity%20threshold%20we%20can%20adjust%20to%20help%20match%20more%20items.%20This%20is%20a%20value%20between%200%20and%201%20that%20indicates%20how%20similar%20values%20need%20to%20be%20in%20order%20to%20match.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E0%20means%20everything%20will%20match.%3C%2FLI%3E%0A%3CLI%3E1%20means%20only%20exact%20matches%20will%20match.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20default%20value%20for%20this%20will%20be%200.8.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDecreasing%20the%20threshold%20to%200.5%20will%20take%20us%20from%202%20of%208%20matches%20to%205%20of%208%20matches.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDecreasing%20the%20threshold%20further%20to%200.3%20will%20get%20us%20all%208%20items%20matching.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBut%20remember%2C%20the%20lower%20the%20threshold%2C%20the%20higher%20the%20likelihood%20of%20getting%20unwanted%20matches.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--779564112%22%20id%3D%22toc-hId--779564112%22%20id%3D%22toc-hId--779564112%22%20id%3D%22toc-hId--779564112%22%3EIgnore%20Case%3C%2FH3%3E%0A%3CP%3EPower%20Query%20is%20case%20sensitive.%20This%20means%20%3CSTRONG%3EX%3C%2FSTRONG%3E%20and%20%3CSTRONG%3Ex%3C%2FSTRONG%3E%20are%20not%20considered%20the%20same%20value.%20This%20will%20be%20true%20when%20merging%20tables%20as%20well.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELuckily%20there%20is%20an%20option%20to%20ignore%20case%20when%20performing%20a%20fuzzy%20match%20merge.%20This%20is%20enabled%20by%20default.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-963246223%22%20id%3D%22toc-hId-963246223%22%20id%3D%22toc-hId-963246223%22%20id%3D%22toc-hId-963246223%22%3EMatch%20by%20Combining%20Text%20Parts%3C%2FH3%3E%0A%3CP%3EThere's%20an%20option%20to%20combine%20text%20parts%20to%20find%20matches.%20This%20means%20Power%20Query%20will%20treat%20things%20like%20%22%3CSTRONG%3Ebirthday%3C%2FSTRONG%3E%22%20the%20same%20as%20%22%3CSTRONG%3Ebirth%20day%3C%2FSTRONG%3E%22.%20This%20is%20enabled%20by%20default.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1588910738%22%20id%3D%22toc-hId--1588910738%22%20id%3D%22toc-hId--1588910738%22%20id%3D%22toc-hId--1588910738%22%3EMaximum%20Number%20of%20Matches%3C%2FH3%3E%0A%3CP%3EWith%20fuzzy%20matching%20there%20is%20the%20potential%20to%20match%20items%20together%20that%20shouldn't%20be%20a%20match.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20option%20will%20help%20prevent%20unwanted%20matches%20by%20limiting%20the%20number%20of%20matches%20that%20are%20returned.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20we%20set%20this%20to%201%2C%20then%20Power%20Query%20will%20only%20return%20the%20best%20match%20and%20won't%20return%20the%20other%20matches%20that%20are%20still%20above%20the%20similarity%20threshold.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBy%20default%20this%20is%20left%20blank%20and%20will%20allow%20up%20to%202%2C147%2C483%2C647%20matches.%202%20billion%20matches%20should%20be%20enough%20for%20anyone.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-153899597%22%20id%3D%22toc-hId-153899597%22%20id%3D%22toc-hId-153899597%22%20id%3D%22toc-hId-153899597%22%3ETransformation%20Table%3C%2FH3%3E%0A%3CP%3EFuzzy%20matching%20has%20a%20very%20handy%20feature%20that%20allows%20us%20to%20set%20a%20transformation%20table.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20allows%20us%20to%20define%20pairs%20of%20values%20we%20consider%20the%20same%20and%20Power%20Query%20will%20treat%20them%20as%20equivalent%20during%20the%20fuzzy%20merge.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20transformation%20table%20can%20be%20created%20by%20creating%20a%20table%20with%20two%20column%20(a%20%3CSTRONG%3EFrom%3C%2FSTRONG%3E%20and%20a%20%3CSTRONG%3ETo%3C%2FSTRONG%3E%20column).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20131px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133360iD2FD5C5CA968EA41%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2205%20Transformation%20Table.png%22%20title%3D%2205%20Transformation%20Table.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20above%20table%20will%20tell%20Power%20Query%20that%20%3CSTRONG%3EMobile%3C%2FSTRONG%3E%20and%20%3CSTRONG%3ECell%3C%2FSTRONG%3E%20should%20be%20considered%20the%20same%20thing%20when%20matching.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1316467294%22%20id%3D%22toc-hId--1316467294%22%20id%3D%22toc-hId--1316467294%22%20id%3D%22toc-hId--1316467294%22%3EExpand%20Merged%20Data%20In%20The%20Power%20Query%20Editor%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20671px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133361i10DEEC0CFBF6D72A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2206%20Expand%20Merged%20Table%20Column.png%22%20title%3D%2206%20Expand%20Merged%20Table%20Column.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20we%20press%20the%20%3CSTRONG%3EOK%26nbsp%3B%3C%2FSTRONG%3Ebutton%20in%20the%20merge%20menu%2C%20this%20will%20open%20up%20the%20Power%20Query%20editor.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20will%20see%20our%20%3CSTRONG%3EListA%3C%2FSTRONG%3E%20%3CSTRONG%3EProduct%3C%2FSTRONG%3E%20data%20and%20a%20%3CSTRONG%3EListB%3C%2FSTRONG%3E%20column%20which%20contains%20a%20bunch%20of%20tables.%20These%20tables%20contain%20our%20merged%20data%20from%20%3CSTRONG%3EListB%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20need%20to%20expand%20out%20this%20ListB%20column%20to%20get%20the%20data.%20Click%20on%20the%20%3CSTRONG%3Eexpand%20toggle%3C%2FSTRONG%3E%20in%20the%20right%20of%20the%20column%20heading%20and%20press%20the%20%3CSTRONG%3EOK%3C%2FSTRONG%3E%20button.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20style%3D%22width%3A%20268px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F133362iD43A6B8B3291F780%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2207%20Fuzzy%20Match%20Results.png%22%20title%3D%2207%20Fuzzy%20Match%20Results.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20can%20now%20%3CSTRONG%3EClose%20%26amp%3B%20Load%3C%2FSTRONG%3E%20our%20results%20into%20a%20table%20in%20our%20workbook%20to%20get%20our%20matched%20results.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-426343041%22%20id%3D%22toc-hId-426343041%22%20id%3D%22toc-hId-426343041%22%20id%3D%22toc-hId-426343041%22%3EConclusions%3C%2FH2%3E%0A%3CP%3EMatching%20data%20is%20a%20very%20common%20task.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EUp%20until%20now%2C%20we%20only%20had%20ways%20to%20find%20exact%20matches.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPartial%20matching%20either%20required%20a%20lot%20of%20manual%20work%20or%20using%20wildcard%20characters%20if%20our%20data%20had%20predictable%20differences.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20we%20have%20a%20quick%20and%20easy%20way%20to%20match%20data%20even%20when%20there%20isn't%20a%20common%20pattern%20to%20the%20differences.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhat%20a%20time%20saver!%20I%20only%20wish%20I%20had%20this%20years%20ago.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-873222%22%20slang%3D%22en-US%22%3E%3CP%3EPower%20Query%20in%20Microsoft%20Excel%20can%20help%20match%20data%20even%20when%20there%20isn't%20an%20obvious%20common%20pattern.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-873222%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-900910%22%20slang%3D%22en-US%22%3ERe%3A%20Fuzzy%20Matching%20in%20Power%20Query%20for%20Microsoft%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-900910%22%20slang%3D%22en-US%22%3E%3CP%3EPro-Tip%3A%20Set%20your%20threshold%20to%201%2C%20but%20tell%20it%20to%20ignore%20case%2C%20and%20it%20will%20do%20an%20exact%20case-insensitive%20match.%20Saves%20having%20to%20always%20get%20your%20join%20columns%20in%20the%20same%20case.%20This%20will%20force%20IgnoreSpace%20to%20not%20be%20valid%20though%20if%20you%20set%20the%20threshold%20to%201.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-910984%22%20slang%3D%22en-US%22%3ERe%3A%20Fuzzy%20Matching%20in%20Power%20Query%20for%20Microsoft%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-910984%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F332452%22%20target%3D%22_blank%22%3E%40JohnMacDougall%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%22What%20a%20time%20saver!%20I%20only%20wish%20I%20had%20this%20years%20ago.%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EYou%20did%20have%20this%20in%20Excel%20since%20late%202010%26nbsp%3B%20as%20an%20Add-in%20called%20Fuzzy%20Lookup%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.microsoft.com%2Fen-in%2Fdownload%2Fdetails.aspx%3Fid%3D15011%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fwww.microsoft.com%2Fen-in%2Fdownload%2Fdetails.aspx%3Fid%3D15011%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3ESince%20then%20it%20has%20had%20exactly%26nbsp%3B1%20Update%20in%20(2014)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThis%20huge%20time%20save%20was%20neither%20promoted%20by%20Microsoft%20nor%20were%20efforts%20made%20to%20fully%20integrate%20it%20to%20Excel.%3C%2FP%3E%3CP%3EIn%20PBI%20it%20came%20only%203%20years%20(Oct%202018)%20after%20the%20%22Idea%22%20submitted%20on%20June%202015.%20In%20Excel%20it%20came%20even%20later.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EEven%20in%20its%20current%20implementation%20there%20are%20some%20gaps.%20For%20E.g.%20in%20the%20Excel%20Addin%20we%20can%20have%20a%20column%20that%20gives%20a%20%25%20indicating%20Jaccard's%20index%20of%20similarity%20-%20In%20PQ%20this%20column%20is%20missing.%20Before%20you%20suggest%20I%20have%20already%20submitted%20it%20as%20an%20Idea%20-%20But%20I%20am%20sure%20a%20few%20years%20from%20now%20it%20will%20get%20implemented%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20there%20is%20no%20way%20currently%20of%20clustering%20in%20to%20Fuzzy%20Groups%20or%20deleting%20Fuzzy%20Duplicates.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EConclusions%3A%3C%2FP%3E%3CP%3EMS%20will%20remain%20a%20company%20with%20unlimited%20potential%20and%20limited%20vision%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESam%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Senior Member

Imagine this. We have been given a list of products from company A and a list of products from company B.

 

Our job is to match products between the two lists. But each company might have slightly different names for the same item.

 

This means we can't just use a lookup function because we don't have exact matches. We can't even use wildcards in a lookup function because the product names aren't different in a predictable way.

 

This is where we realize we have to manually match our products from the two lists and eventually we give up and start to cry! Right?

 

No, because we now have a fuzzy match option in Power Query. Lazy people rejoice!

 

Not sure what Power Query is? Then check out this Introduction to Power Query beforehand.

 

Example

01 List of Products.png

 

In our example, we have List A and List B. These are small and only have the one column, but imagine we're working with two large datasets with hundreds or thousands or products and many other columns.

 

We can see that none of the items in each list is an exact match, but they are likely the same product.

 

For example, in list A we have "Macaroni and cheese", but in list B we have "Macaroni & Cheese". They are the same thing but slightly different.

 

Create A Query For Both Tables

Both these lists have been converted into Excel Tables named ListA and ListB. The first thing we will need to do is create a query for each table.

  1. Select a cell inside the table.
  2. Go to the Data tab.
  3. Use the From Table/Range query command.
  4. Go to the Home tab in the Power Query editor.
  5. Select Close & Load ➜ Close & Load To.
  6. Choose Only Create Connection from the Import Data menu.

Once this is done for both tables, we'll be able to merge (join) the tables in another query.

 

Create A Merge Query Using Both Tables

Power Query has an option to merge tables.

 

This allows us to join data in two tables based on a common field like an ID column, or in our case the Product name column.

 

This is where we'll also find the new fuzzy match feature.

 

02 Merge Queries.png

 

Create a Merge query.

  1. Go to the Data tab.
  2. Choose Get Data from the ribbon.
  3. Choose Combine Queries from the menu.
  4. Choose Merge.

This will open up the Merge query menu.

 

Merge Menu Settings

 

03 Merge Menu.png

 

The Merge menu is where we can enable fuzzy matching.

  1. Select the first query we want to merge. For us, this will be ListA. We also need to select the column to base the merge on, for us this is the Product name column.
  2. Select the second query we want to merge and the column to base the merge on.
  3. We also need to select what type of join to perform. There are several choice, but we'll stick with the default option to return all items from the first list and only matching items from the second list. This is also where we can select fuzzy matching as an option, check the Use fuzzy matching to perform the merge box.

Notice at the bottom of the merge menu, Power Query tells us how many matches are found. When we enable fuzzy matches, this goes from 0 of 8 to 2 of 8.

 

Fuzzy Matching Options

We've already improved our matching by just enabling the fuzzy matching option. But there are more settings we can use to help improve the matching.

 

04 Fuzzy Matching Options.png

 

Click on the collapsed Fuzzy matching options and more advanced settings will be revealed. These can help us match more items in our lists.

 

Similarity Threshold

There's a similarity threshold we can adjust to help match more items. This is a value between 0 and 1 that indicates how similar values need to be in order to match.

  • 0 means everything will match.
  • 1 means only exact matches will match.

The default value for this will be 0.8.

 

Decreasing the threshold to 0.5 will take us from 2 of 8 matches to 5 of 8 matches.

 

Decreasing the threshold further to 0.3 will get us all 8 items matching.

 

But remember, the lower the threshold, the higher the likelihood of getting unwanted matches.

 

Ignore Case

Power Query is case sensitive. This means X and x are not considered the same value. This will be true when merging tables as well.

 

Luckily there is an option to ignore case when performing a fuzzy match merge. This is enabled by default.

 

Match by Combining Text Parts

There's an option to combine text parts to find matches. This means Power Query will treat things like "birthday" the same as "birth day". This is enabled by default.

 

Maximum Number of Matches

With fuzzy matching there is the potential to match items together that shouldn't be a match.

 

This option will help prevent unwanted matches by limiting the number of matches that are returned.

 

If we set this to 1, then Power Query will only return the best match and won't return the other matches that are still above the similarity threshold.

 

By default this is left blank and will allow up to 2,147,483,647 matches. 2 billion matches should be enough for anyone.

 

Transformation Table

Fuzzy matching has a very handy feature that allows us to set a transformation table.

 

This allows us to define pairs of values we consider the same and Power Query will treat them as equivalent during the fuzzy merge.

 

A transformation table can be created by creating a table with two column (a From and a To column).

 

05 Transformation Table.png

 

The above table will tell Power Query that Mobile and Cell should be considered the same thing when matching.

 

Expand Merged Data In The Power Query Editor

 

06 Expand Merged Table Column.png

 

When we press the OK button in the merge menu, this will open up the Power Query editor.

 

We will see our ListA Product data and a ListB column which contains a bunch of tables. These tables contain our merged data from ListB.

 

We need to expand out this ListB column to get the data. Click on the expand toggle in the right of the column heading and press the OK button.

 

07 Fuzzy Match Results.png

 

We can now Close & Load our results into a table in our workbook to get our matched results.

 

Conclusions

Matching data is a very common task.

 

Up until now, we only had ways to find exact matches.

 

Partial matching either required a lot of manual work or using wildcard characters if our data had predictable differences.

 

Now we have a quick and easy way to match data even when there isn't a common pattern to the differences.

 

What a time saver! I only wish I had this years ago.

 

 

2 Comments
Contributor

Pro-Tip: Set your threshold to 1, but tell it to ignore case, and it will do an exact case-insensitive match. Saves having to always get your join columns in the same case. This will force IgnoreSpace to not be valid though if you set the threshold to 1.

Established Member

@JohnMacDougall 

 

"What a time saver! I only wish I had this years ago."

You did have this in Excel since late 2010  as an Add-in called Fuzzy Lookup

https://www.microsoft.com/en-in/download/details.aspx?id=15011

 

Since then it has had exactly 1 Update in (2014)

This huge time save was neither promoted by Microsoft nor were efforts made to fully integrate it to Excel.

In PBI it came only 3 years (Oct 2018) after the "Idea" submitted on June 2015. In Excel it came even later.

 

Even in its current implementation there are some gaps. For E.g. in the Excel Addin we can have a column that gives a % indicating Jaccard's index of similarity - In PQ this column is missing. Before you suggest I have already submitted it as an Idea - But I am sure a few years from now it will get implemented

 

Also there is no way currently of clustering in to Fuzzy Groups or deleting Fuzzy Duplicates.

 

Conclusions:

MS will remain a company with unlimited potential and limited vision

 

Sam