Forum Discussion
donnawoman
Jul 10, 2021Copper Contributor
why doesn't Excel recognize the TEXTBEFORE() and TEXTAFTER() functions when I try to use them?
When I attempt to use these functions, Excel returns the #NAME? error message.
DaveG27
Mar 12, 2024Copper Contributor
donnawoman thanks to https://chat.openai.com/, I was given this answer which works as desired (in my case, my text was in A4, between a '.' and a '@'):
=LEFT(MID(A4, FIND(".", A4) + 1, LEN(A4)), FIND("@", MID(A4, FIND(".", A4) + 1, LEN(A4))) - 1)
Explanation:
- FIND(".", A4): Finds the position of the first occurrence of "." in cell A4.
- MID(A4, FIND(".", A4) + 1, LEN(A4)): Extracts the substring of A4 starting from one character after the first "." to the end.
- FIND("@", MID(A4, FIND(".", A4) + 1, LEN(A4))): Finds the position of the "@" symbol within the extracted substring.
- LEFT(..., FIND(...) - 1): Takes the left part of the extracted substring, ending just before the "@" symbol.
This formula essentially extracts the text between the first "." and "@" symbols in cell A4.
SergeiBaklan
Mar 12, 2024Diamond Contributor