Forum Discussion
cerebro
Helper I
3 years agoCheck if column text contains values from another column and return the text
Dear everybody, I have two different sources and i would like to search for the project number from the second source in the account from the first source and return the project in the custom col...
- 3 years ago
Hi cerebro
Yes, you can use Text.BetweenDelimiters to extract just the 4 digits between the - -
= Text.Select(Text.BetweenDelimiters([Account], "-", "-"), {"0".."9"})Regards
Phil
PhilipTreacy
Super User
3 years agoHi cerebro
If your Account in Source1 always contains only one 4 digit project code (or none), then you can extract it using this. No lookup to Source2 needed.
= Text.Select([Account], {"0".."9"})
If the Account in Source1 might also contain numbers that are not Project Codes, you could use this which does check against Source2
= if List.Contains(Source2[Project],Text.Select([Account], {"0".."9"})) then Text.Select([Account], {"0".."9"}) else null
regards
Phil
cerebro
Helper I
3 years agothank you for the elegant solution.
Yes in fact, there are some other numbers that do not represent a project number and if you replace any letter with a number, the second formula doesnt work anymore:
Can you fix it? Thanks again!