Reputation: 23
I have data in the cell in this format saved in A column in Excel.
[Amber,Maria,Marian,Mar]
[Maria]
[Marian,Amber,Maria]
[Maria,Marian]
I want a filter for Maria and Marian.
How can I use some regex formula filtering Maria and Marian separately?
I am using pivot filters and want to use a custom formula there.
contain(A1,"Maria")
will return Maria and Marian both.
Upvotes: 2
Views: 165
Reputation: 75870
Google Sheets and Excel are two different apps. Benefits of GS is indeed, as you mentioned in your question, the use of regular expressions. Reading your question there are two possibilities that pop into mind:
Formula in B1
:
=INDEX(REGEXMATCH(A1:A5,"Maria\b"))
Formula in C1
:
=QUERY(A:A,"where A matches '.*Maria\b.*'")
Upvotes: 1
Reputation: 11483
=ISNUMBER(SEARCH("Maria,",SUBSTITUTE(A1:A4,"]",",")))
shows TRUE
if Maria
is found and false if it would only be Marian
, not Maria
.
Upvotes: 3