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
-
- AVEDEV
- AVERAGE
- AVERAGEA
- AVERAGEIF
- AVERAGEIFS
- BETADIST
- BETAINV
- BINOMDIST
- CHIDIST
- CHIINV
- CHITEST
- CONFIDENCE
- CORREL
- COUNT
- COUNTA
- COUNTBLANK
- COUNTIF
- COUNTIFS
- COVAR
- CRITBINOM
- DEVSQ
- EXPONDIST
- FDIST
- FINV
- FORECAST
- FREQUENCY
- GAMMADIST
- GAMMAINV
- GAMMALN
- GEOMEAN
- HARMEAN
- INTERCEPT
- LARGE
- LINEST
- LOGINV
- LOGNORMDIST
- MAX
- MAXA
- MAXIFS
- MEDIAN
- MIN
- MINA
- MINIFS
- MODE
- NEGBINOMDIST
- NORMDIST
- NORMINV
- NORMSDIST
- NORMSINV
- PERCENTILE
- PERCENTRANK
- PERMUT
- POISSON
- PROB
- QUARTILE
- RANK
- SLOPE
- SMALL
- STANDARDIZE
- STDEV
- STDEVA
- STDEVP
- STDEVPA
- TDIST
- TINV
- TTEST
- VAR
- VARA
- VARP
- VARPA
- WEIBULL
- ZTEST
- Copyright
![](https://help.apple.com/assets/6467B9B3CF36103D3A318861/6467B9B8CF36103D3A318879/en_US/784be3dfed809d4b6bb7cc427d8c5f01.png)
TEXTBETWEEN
The TEXTBETWEEN function returns a string value consisting of all characters that appear between two given substrings in the original string value.
TEXTBETWEEN(source-string, first-search-string, second-search-string, first-occurrence, second-occurrence)
source-string: Any value.
first-search-string: The string value to search for as the first match.
second-search-string: The string value to search for as the second match.
first-occurrence: An optional value indicating which occurrence of first-search-string within source-string to match (1 for first match, 2 for second match, …, -1 for last match, -2 for second to last match, …). If omitted, set to 1.
second-occurrence: An optional value indicating which occurrence of second-search-string within source-string (after first-occurrence) to match (1 for first match, 2 for second match, …, -1 for last match, -2 for second to last match, …). If omitted, set to 1.
Notes
By default, if there are multiple occurrences of first-search-string in source-string and no value is specified for first-occurrence, TEXTBETWEEN returns text starting from the first occurrence. If there are multiple occurrences of second-search-string in source-string and no value is specified for second-occurrence, TEXTBETWEEN returns text up to the first occurrence of second-search-string after the first occurrence of first-search-string.
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 |
---|
=TEXTBETWEEN("Apple,Banana,Strawberry", ",", ",") returns "Banana." =TEXTBETWEEN("Extract the text between the first occurrence of the and the last occurrence of text", "the", "text", 1, -1) returns " text between the first occurrence of the and the last occurrence of ". =TEXTBETWEEN("Extract the text between the first occurrence of the and the last occurrence of text", "text", "the") returns " between ". =TEXTBETWEEN("Get all the text between the two numbers 45120 and 31233", REGEX("[0-9]+"), REGEX("[0-9]+")) returns " and ". |