Formulas and Functions Help
- Welcome
 - Intro to formulas and functions
 - 
        
        
- 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
 
 

SUBSTITUTE
The SUBSTITUTE function returns a string value where the specified characters of a given string value have been replaced with a new string value.
SUBSTITUTE(source-string, existing-string, new-string, occurrence)
source-string: Any value.
existing-string: The value to be replaced. existing-string can contain any value.
new-string: The value used as a replacement. new-string can contain any value. It does not have to be the same length as existing string.
occurrence: An optional number value specifying which occurrence of existing-string within source-string should be replaced. occurrence must be greater than or equal to 1, or omitted. If occurrence is greater than the number of times existing-string appears within source-string, no replacement will occur. If occurrence is omitted, all occurrences of existing-string within source-string will be replaced by new-string.
Notes
You can replace individual characters, whole words or strings of characters within words.
If REGEX is used to specify the search value in existing-string, capture groups can be used in new-string.
Examples  | 
|---|
=SUBSTITUTE("a b c d e f", "b", "B") returns "a B c d e f". =SUBSTITUTE("a a b b b c", "a", "A", 2) returns "a A b b b c". =SUBSTITUTE("a a b b b c", "b", "B") returns "a a B B B c". =SUBSTITUTE("aaabbccc", "bc", "BC", 2) returns "aaabbccc". =SUBSTITUTE(60606, 6, 3) returns "30303". =SUBSTITUTE("example@example.com: Marina Email", REGEX("[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}") & REGEX(": *"), "") returns "Marina Email". =SUBSTITUTE("marina@example.com", REGEX("([A-Z0-9a-z._%+-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,4})"), "$1") returns "marina". By using the first capture group in the REGEX, you extract only the username. =SUBSTITUTE("marina@example.com", REGEX("([A-Z0-9a-z._%+-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,4})"), "$2") returns "example.com". By using the second capture group in the REGEX, you extract only the domain name.  |