| =SUBSTITUTE("a-b-a-b","a","X") |
Without instance_num, every occurrence of old_text is replaced |
X-b-X-b |
X-b-X-b |
Matched |
| =SUBSTITUTE("a-b-a-b","a","X",2) |
instance_num=2 replaces only the 2nd occurrence of old_text, leaving the 1st untouched |
a-b-X-b |
a-b-X-b |
Matched |
| =SUBSTITUTE("hello","z","X") |
old_text not present in text returns the text unchanged |
hello |
hello |
Matched |
| =SUBSTITUTE("Apple","a","X") |
SUBSTITUTE matches old_text case-sensitively; lowercase 'a' does not match the uppercase 'A' in "Apple", so the text is returned unchanged |
Apple |
Apple |
Matched |