Forum Discussion
Erase words (from a dictionary) in paragraphs across multiple cells
- Nov 25, 2022
'e' is assigning a name to a parameter in the array that MAP will check. Essentially, what MAP allows you to do is to perform a calculation on each 'element' in an array. If you study MAP, you may also look into the functions mentioned here:
Announcing LAMBDA Helper Functions (microsoft.com)
I've updated the sample to account for those anomalies. CheckWords is a LAMBDA designed to pull out words found in Column A.
'CheckWords 'This function 'explodes' a cell converting it to an array. MAP replaces words found in the Words list with a blank. =LAMBDA(element,TEXTJOIN(" ",,MAP(TEXTSPLIT(element, " "), LAMBDA(word, IF(ISNUMBER(XMATCH(word, words)), "", word)))))CheckWords is then run on each 'element' within the paragraphs array.
=MAP(paragraphs,LAMBDA(e,CheckWords(e)))
'e' is assigning a name to a parameter in the array that MAP will check. Essentially, what MAP allows you to do is to perform a calculation on each 'element' in an array. If you study MAP, you may also look into the functions mentioned here:
Announcing LAMBDA Helper Functions (microsoft.com)
I've updated the sample to account for those anomalies. CheckWords is a LAMBDA designed to pull out words found in Column A.
'CheckWords
'This function 'explodes' a cell converting it to an array. MAP replaces words found in the Words list with a blank.
=LAMBDA(element,TEXTJOIN(" ",,MAP(TEXTSPLIT(element, " "), LAMBDA(word, IF(ISNUMBER(XMATCH(word, words)), "", word)))))
CheckWords is then run on each 'element' within the paragraphs array.
=MAP(paragraphs,LAMBDA(e,CheckWords(e)))
Thank you so much! I'm gonna study now 😉
- Patrick2788Nov 25, 2022Silver ContributorYou're welcome! Glad I could help.