Forum Discussion
XLOOKUP
Hi
I have a database with various customers with their email addresses. I use the XLOOKUP to get the email addresses of a specific person. My problem is that the result bring back "0" value and not the email address when the same person have "blank" in the email address fields. Sample:
Source:
Dale Isaac | |
Dale Isaac | email address removed for privacy reasons |
Dale Isaac | |
Dale Isaac |
Formula used: =XLOOKUP(B22;contact[fullname];contact[emailaddress1]; " " )
Result:
"0" (Zero)
How can I fix it that the email is in the lookup?
- Riny_van_EekelenPlatinum Contributor
007Nic XLOOKUP returns only the first match it finds. So, it finds the first "Dale Isaac" and returns whatever it finds in the email column on that row. If that cell is blank the result is 0.
You need to look into FILTER and TEXTJOIN. Then you can get all email addresses for a particular person and join them into one text string. If that's what you want, of course.
EDIT: file with an example attached.
- 007NicCopper ContributorThanks you Riny.
In this scenario there will not be more than one email per person, only blanks. If I can get the email address which ignore all the blank rows it will be great.- Riny_van_EekelenPlatinum Contributor
007Nic Did you see the file I attached earlier? Remove the 2nd email address and the formula will still work. But, if you are 100% sure that there will never be more than one email address per person you could shorten the formula by removing the arguments relating to the TEXTJOIN function (bold red below).
=TEXTJOIN(", ",TRUE,FILTER(contacts[emailaddress],(contacts[fullname]=E7)*(contacts[emailaddress]<>""),""))