Formulas and Functions Help
- Welcome
-
- ACCRINT
- ACCRINTM
- BONDDURATION
- BONDMDURATION
- COUPDAYBS
- COUPDAYS
- COUPDAYSNC
- COUPNUM
- CUMIPMT
- CUMPRINC
- CURRENCY
- CURRENCYCODE
- CURRENCYCONVERT
- CURRENCYH
- DB
- DDB
- DISC
- EFFECT
- FV
- INTRATE
- IPMT
- IRR
- ISPMT
- MIRR
- NOMINAL
- NPER
- NPV
- PMT
- PPMT
- PRICE
- PRICEDISC
- PRICEMAT
- PV
- RATE
- RECEIVED
- SLN
- STOCK
- STOCKH
- SYD
- VDB
- XIRR
- XNPV
- YIELD
- YIELDDISC
- YIELDMAT
-
- ABS
- CEILING
- COMBIN
- COMBINA
- EVEN
- EXP
- FACT
- FACTDOUBLE
- FLOOR
- GCD
- INT
- LCM
- LN
- LOG
- LOG10
- MDETERM
- MINVERSE
- MMULT
- MOD
- MROUND
- MULTINOMIAL
- MUNIT
- ODD
- PI
- POLYNOMIAL
- POWER
- PRODUCT
- QUOTIENT
- RAND
- RANDARRAY
- RANDBETWEEN
- ROMAN
- ROUND
- ROUNDDOWN
- ROUNDUP
- SEQUENCE
- SERIESSUM
- SIGN
- SQRT
- SQRTPI
- SUBTOTAL
- SUM
- SUMIF
- SUMIFS
- SUMPRODUCT
- SUMSQ
- SUMX2MY2
- SUMX2PY2
- SUMXMY2
- TRUNC
-
- ADDRESS
- AREAS
- CHOOSE
- CHOOSECOLS
- CHOOSEROWS
- COLUMN
- COLUMNS
- DROP
- EXPAND
- FILTER
- FORMULATEXT
- GETPIVOTDATA
- HLOOKUP
- HSTACK
- HYPERLINK
- INDEX
- INDIRECT
- INTERSECT.RANGES
- LOOKUP
- MATCH
- OFFSET
- REFERENCE.NAME
- ROW
- ROWS
- SORT
- SORTBY
- TAKE
- TOCOL
- TOROW
- TRANSPOSE
- UNION.RANGES
- UNIQUE
- VLOOKUP
- VSTACK
- WRAPCOLS
- WRAPROWS
- XLOOKUP
- XMATCH
-
- AVEDEV
- AVERAGE
- AVERAGEA
- AVERAGEIF
- AVERAGEIFS
- BETADIST
- BETAINV
- BINOMDIST
- CHIDIST
- CHIINV
- CHITEST
- CONFIDENCE
- CORREL
- COUNT
- COUNTA
- COUNTBLANK
- COUNTIF
- COUNTIFS
- COVAR
- CRITBINOM
- DEVSQ
- EXPONDIST
- FDIST
- FISHER
- FISHERINV
- FINV
- FORECAST
- FREQUENCY
- GAMMA
- GAMMADIST
- GAMMAINV
- GAMMALN
- GEOMEAN
- HARMEAN
- INTERCEPT
- LARGE
- LINEST
- LOGINV
- LOGNORMDIST
- MAX
- MAXA
- MAXIFS
- MEDIAN
- MIN
- MINA
- MINIFS
- MODE
- NEGBINOMDIST
- NORMDIST
- NORMINV
- NORMSDIST
- NORMSINV
- PEARSON
- PERCENTILE
- PERCENTRANK
- PERMUT
- PERMUTATIONA
- PHI
- POISSON
- PROB
- QUARTILE
- RANK
- RSQ
- SLOPE
- SMALL
- STANDARDIZE
- STDEV
- STDEVA
- STDEVP
- STDEVPA
- TDIST
- TINV
- TTEST
- VAR
- VARA
- VARP
- VARPA
- WEIBULL
- ZTEST
- Copyright and trademarks

TEXTBEFORE
The TEXTBEFORE function returns a string value consisting of all characters that appear before a given substring in the original string value.
TEXTBEFORE(source-string, search-string, occurrence)
source-string: Any value.
search-string: The string value to search for.
occurrence: An optional value indicating which occurrence of search-string within source-string to match. (Use 1 for the first match, 2 for the second match, and so on. Use -1 for the last match, -2 for the second-to-last match, and so on.) If omitted, set to 1.
Notes
By default, if there are multiple occurrences of search-string in source-string, TEXTBEFORE returns the text up to (and excluding) the first occurrence.
If search-string isn’t found within source-string, or if the given occurrence can’t be found, an error is returned.
REGEX is permitted in search-string for more complex searches.
By default, the search isn't case sensitive. To consider case in your search, use the REGEX function for search-string.
Examples |
|---|
=TEXTBEFORE("Marina Cavanna", " ") returns "Marina". =TEXTBEFORE("If you want to return the text before the second to, in case there are multiple to occurrences.", "to", 2) returns "If you want to return the text before the second ". =TEXTBEFORE("All the text before the very last occurrence of the word the", "the", -1) returns "All the text before the very last occurrence of the word ". =TEXTBEFORE("Get all the text before an email like marina@example.com", REGEX("([A-Z0-9a-z._%+-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,4})")) returns "Get all the text before an email like ". =TEXTBEFORE("All the text before the table of contents"," ",3) returns “All the text”. |