Excel Substitutions

Richard Tillman 405 Reputation points
2026-09-29T18:07:20.93+00:00

In col A, I have

old1

old2

old3

...

In col B, I have

new1

new2

new3

...

In D1, I have:

=substitute(C1,A1,B1)

so that text entered in C1 is shown in D1 with old1 substituted by new1.

But, for that single cell C1, I want to apply every listed sub. E.g., Entering "id old1 id old3" in C1 yields "id new1 id new3" in D1

Longform, one method for this would be D1:

=substitute(substitute(substitute(C1,A1,B1),A2,B2),A3,B3)

for the first 3 substitutions. How can I implement this effect efficiently, for however long the substitution list is, whether by generating a nested substitution like that, or with a different method — but just using sheet formulas, without using a macro please.

Microsoft 365 and Office | Excel | For home | Windows
0 comments No comments

Answer accepted by question author
Ashish Mathur 102.5K Reputation points Volunteer Moderator
2026-09-29T23:59:28.2666667+00:00

Hi,

Enter this formula in cell D2

=REDUCE(C2,$A$2:$A$4,LAMBDA(a,b,SUBSTITUTE(a,b,XLOOKUP(b,$A$2:$A$4,$B$2:$B$4))))

Hope this helps.

User's image

Was this answer helpful?

2 people found this answer helpful.

Answer accepted by question author
Jeronimo Fuerte 46,645 Reputation points Independent Advisor
2026-09-29T19:16:41.3066667+00:00

You can use REDUCE together with LAMBDA to apply each substitution in sequence. For example, if your substitutions are in A1 and B1, and the original text is in C1, try:

=LET(old,FILTER(A1,A1<>""),new,FILTER(B1,A1<>""),REDUCE(C1,SEQUENCE(ROWS(old)),LAMBDA(txt,i,SUBSTITUTE(txt,INDEX(old,i),INDEX(new,i)))))

This first removes any unused rows from the substitution list and then applies each old/new pair one after another. Therefore, if C1 contains id old1 id old3, with old1/new1 and old3/new3 in columns A and B, the result will be id new1 id new3. You can increase A1 and B1 as needed, or preferably convert the substitution list to an Excel Table if it will continue growing.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Dana D 100 Reputation points
    2026-10-01T03:13:32.7033333+00:00

    [EDITED] Has a solution.

    User's image

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.