# Tags **Software** : [[02 - Tags/Software/Power Query|Power Query]] **Functions** used : [[Excel.Workbook]] [[Table.Buffer]] [[Table.AddColumn]] [[Table.SelectRows]] [[Table.RowCount]] **Date** : 25-March-2026 # Description In this video i show you how to do conditional lookups first on multiple email addresses and then on name matches. # Video Link <iframe width="560" height="315" src="https://www.youtube.com/embed/wGfrkcbM8jY?si=AVYCRCfMIRfo-N38" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe> [GITHUB File Link](https://github.com/jbotes/powerbiTutorials/blob/main/PQ_Emaillookup_video.xlsx) # M-Query ```mquery let Source = Excel.CurrentWorkbook(){[Name="SourceTable"]}[Content], lookuptbl = Table.Buffer(Excel.CurrentWorkbook(){[Name="lookup"]}[Content]), Custom1 = Table.AddColumn(Source, "Age", each let matches = Table.SelectRows(lookuptbl, (lkp)=> lkp[email1] = [email] or lkp[email2] = [email] ) in if Table.RowCount(matches) > 0 then Table.SelectRows(matches, (lkp)=> lkp[firstname] & " " & lkp[lastname] = [fullname])[age]{0} ? ?? Table.SelectRows(lookuptbl, (lkp)=> lkp[firstname] & " " & lkp[lastname] = [fullname])[age]{0} ? else Table.SelectRows(lookuptbl, (lkp)=> lkp[firstname] & " " & lkp[lastname] = [fullname])[age]{0} ? ) in Custom1 ``` ## Optional Tags **Tags** : **Technique** : [[Nested Let]] [[Error Try]] [[Custom Function]]