A lookup table should work, try using a vlookup. You want to take the 2 right characters from the address and use that as the lookup value to return the upper case version, roughly like this (assume address in A1):

new value = left(A1, len(A1)-2) & vlookup(right(A1, 2), Q31:R35, 2, false)

also if there is no complex mapping i.e. you are always just capitalizing the last 2 characters you could do this:

new value = left(A1, len(A1)-2) & upper(right(A1, 2))
Answer from lllpratll on Stack Overflow
๐ŸŒ
MrExcel
mrexcel.com โ€บ forums โ€บ question forums โ€บ excel questions
SUBSTITUTE equivalent function for a range of cells | MrExcel Message Board
April 15, 2022 - I want to find each one of the 800 entries on Sheet1 in the text strings in the range on Sheet2 and replace or substitute with null or "". It sure seems like there is an easy solution here but since SUBSTITUTE does not work on a range, I am stumped. I am guessing I am going to have to use a macro but was hoping to avoid macros if possible and instead use some native Excel functions.
Discussions

How to use SUBSTITUTE() for a range of values?
Substitute won't work. It will change: Nyack, Ny to NYack, NY. If your data is as clean as you say it is: =LEFT(A2,LEN(A2)-2)&UPPER(RIGHT(A2,2)) More on reddit.com
๐ŸŒ r/excel
7
1
December 13, 2016
vba - Advanced substitute in excel with range - Stack Overflow
I'm trying to replace 1400 cells with text into cells with ids, I've attached a picture so you can understand it easier. I'm trying to do this only by using cells because I have 1400 cells I need to More on stackoverflow.com
๐ŸŒ stackoverflow.com
vba - In Excel, use "Range.Replace" method to substitute characters, but do not affect formulae - Stack Overflow
I want to create a macro for Excel (2010) to substitute characters of the Latin alphabet with their equivalents from the Cyrillic alphabet. At first glance, this seems to be quite easy, e.g. like... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Substitute Function in Excel VBA for cell range - Stack Overflow
I have to replace one character with another in Excel file. I have used following Replace function, but due to exceeds of 1024 character limit in some cells, it stops there. Sub Replace() With More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
YouTube
youtube.com โ€บ technology for teachers and students
Using the Excel SUBSTITUTE Function - YouTube
Learn how to use the Excel SUBSTITUTE function to make changes to specific ranges of your text. Works like magic! ***Support Technology for Teachers and Stud...
Published: December 6, 2022
Views: 30K
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ office โ€บ vba โ€บ api โ€บ excel.range.replace
Range.Replace method (Excel) | Microsoft Learn
May 21, 2025 - This example replaces every occurrence of the trigonometric function SIN with the function COS. The replacement range is column A on Sheet1.
๐ŸŒ
Reddit
reddit.com โ€บ r/excel โ€บ how to use substitute() for a range of values?
r/excel on Reddit: How to use SUBSTITUTE() for a range of values?
December 13, 2016 -

Let's say that there are multiple values like such:

Address
123 Fake Street, Philadelphia, pa
456 Real Street, Houston, tx
789 Soho Street, New York, ny

Originally, I thought I could create a lookup table to search for "pa", "tx", and "ny" so that they would get upper'd: "PA", "TX", "NY".

Ideally, I want to write a function that would have all of the upper values in a new column. Originally, something like this:

=substitute(O33,Q31:Q35,R31:R35)

with Q31:Q35 being the range of lower states, and R31:R35 being the upper states. However, that didn't work out the way I wanted. Is there a way to do the replacement of lower case states without hard coding? I thought a lookup table would work, but it didn't.

I want the end result to be something like this:

Address                                     New Address
123 Fake Street, Philadelphia, pa           123 Fake Street, Philadelphia, PA
456 Real Street, Houston, tx                456 Real Street, Houston, TX
789 Soho Street, New York, ny               789 Soho Street, New York, NY

Without doing this for every row of New Address:

substitute(A2, "pa", "PA")
substitute(A3, "tx", "TX")
substitute(A4, "ny", "NY")

Ideally, I would like the answer to use the SUBSTITUTE() function. If it's not possible, please let me know.

๐ŸŒ
Exceljet
exceljet.net โ€บ home โ€บ functions โ€บ substitute function
Excel SUBSTITUTE function | Exceljet
January 23, 2026 - To find and replace multiple values (i.e., perform a batch replace all operation), you can use the REDUCE function with a custom LAMBDA function to perform multiple substitutions in a single operation.
๐ŸŒ
LiveFlow
liveflow.com โ€บ product-guides โ€บ substitute-function-in-excel-explained
SUBSTITUTE Function in Excel: Explained | LiveFlow
The SUBSTITUTE function in Excel is a powerful tool that allows you to replace specific text values or characters within a cell or a range of cells with new text values or characters.
๐ŸŒ
Exceljet
exceljet.net โ€บ home โ€บ formulas โ€บ find and replace multiple values
Find and replace multiple values - Excel formula | Exceljet
October 29, 2025 - To find and replace multiple values (i.e., perform a batch replace all operation), you can use the REDUCE function with a custom LAMBDA function to perform multiple substitutions in a single operation.
Find elsewhere
๐ŸŒ
Ablebits
ablebits.com โ€บ ablebits blog โ€บ excel โ€บ find & replace โ€บ excel: find and replace multiple values at once
Excel: find and replace multiple values at once
June 26, 2026 - All you need to do is to enter the unwanted characters in a predefined range, one per cell, and then use a REDUCE formula like this one: =REDUCE(A3:A10, D3:D8, LAMBDA(a, v, SUBSTITUTE(a, v, "")))
๐ŸŒ
Ablebits
ablebits.com โ€บ ablebits blog โ€บ excel โ€บ find & replace โ€บ using excel replace and substitute functions - formula examples
Using Excel REPLACE and SUBSTITUTE functions - formula examples
March 21, 2023 - The tutorial explains the Excel REPLACE and SUBSTITUTE functions with examples of uses. See how to use the REPLACE function with text strings, numbers and dates, and how to nest several REPLACE or SUBSTITUTE functions within one formula.
๐ŸŒ
Automate Excel
automateexcel.com โ€บ home โ€บ substitute multiple values โ€“ excel & google sheets
Substitute Multiple Values - Excel & Google Sheets - Automate Excel
February 8, 2023 - This method works the same way ... a find and replace range with the values. Two INDEX functions are needed for each SUBSTITUTE (one for the find value and another for the replace value). These formulas work exactly the same in Google Sheets as in Excel....
๐ŸŒ
Microsoft Support
support.microsoft.com โ€บ en-us โ€บ office โ€บ substitute-function-6434944e-a904-4336-a9b0-1e58df3bc332
SUBSTITUTE function | Microsoft Support
Excel for Microsoft 365 Excel for Microsoft 365 for Mac Excel 2024 Excel 2024 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2016 ยท This article describes the formula syntax and usage of the SUBSTITUTE function in Microsoft Excel.
๐ŸŒ
Excel Forum
excelforum.com โ€บ excel-formulas-and-functions โ€บ 988219-substitute-function-for-a-range.html
SUBSTITUTE Function for a range
This error is something I can not fix as it is incorrectly named from another source I have no control over and I do not wish to have to do a find and replace every day when using this template. Thanks. ... Hi and welcome to the forum =SUBSTITUTE() works on a cell, not a range You would need ...
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 29659584 โ€บ advanced-substitute-in-excel-with-range โ€บ 29662141
vba - Advanced substitute in excel with range - Stack Overflow
Damn, that image isn't big enough, is it? You can see the layout though. "Original Text" is in C1, and the word ID is in A5, and I've numbered D1:I1 1-6. Now paste this formula into D2: =SUBSTITUTE(C2,OFFSET($B$6,D$1-1,0),OFFSET($A$6,D$1-1,0))
Top answer
1 of 3
7

Range.Replace will always search in formulas.

There is a HasFormula property in the Range object. But for using this you must iterate over all cells in the given Range. If this Range is quite big then this will take quite long if you are trying Replace in each of the cells. So I would only trying Replace if the cell is not empty, is not numeric and not has a formula.

Sub test()

 Dim oRange As Range

 For Each oRange In ActiveSheet.Range("A1:Z500")
  If Not IsEmpty(oRange) And Not IsNumeric(oRange.Value) And Not oRange.HasFormula Then
    oRange.Replace What:="sht", Replacement:=ChrW(1097), MatchCase:=True
    oRange.Replace What:="Sht", Replacement:=ChrW(1065), MatchCase:=True
  End If
 Next

End Sub

Oh and you must set MatchCase if the replace shall be case sensitive.

Second approach:

You also could use the VBA Replace instead of Range.Replace as showed in the other answer. But not with Range.Formula but with Range.Value.

This could be faster.

Sub test2()

 Dim oRange As Range

 For Each oRange In ActiveSheet.Range("A1:Z500")
  If Not IsEmpty(oRange) And Not IsNumeric(oRange.Value) And Not oRange.HasFormula Then
    oRange.Value = Replace(oRange.Value, "sht", ChrW(1097), , , vbBinaryCompare)
    oRange.Value = Replace(oRange.Value, "Sht", ChrW(1065), , , vbBinaryCompare)
  End If
 Next

End Sub
2 of 3
0

You have to look in .Formula properties, default Range result give the .Value (ie result), not value.

I will suggest use a loop like :

For Each cell In ActiveSheet.Range("A1:Z500")
    cell.Formula = Replace(cell.Formula, "sht", ChrW(1097))
    cell.Formula = Replace(cell.Formula, "Sht", ChrW(1095))
Next
๐ŸŒ
Exceldome
exceldome.com โ€บ home โ€บ solutions โ€บ excel substitute function | excel, vba
Excel SUBSTITUTE Function | Excel, VBA
August 15, 2018 - ADJUSTABLE PARAMETERS Output Range: Select the output range by changing the cell references ("F5"), ("F6") and ("F7") in the VBA code to any cell in the worksheet, that doesn't conflict with formula.
๐ŸŒ
Better Solutions
bettersolutions.com โ€บ excel โ€บ named-ranges โ€บ substituting-labels.htm
Excel Named Ranges - Substituting Labels Automatically
This automatic substitution will only work by entering an equal sign and selecting the cell using the mouse. Select (Insert > Name > Label) to display the Label Ranges dialog box.
๐ŸŒ
Spreadsheet Planet
spreadsheetplanet.com โ€บ home โ€บ excel functions โ€บ substitute function in excel
SUBSTITUTE Function in Excel (5 Easy Examples)
June 4, 2026 - It finds a piece of text you specify and replaces it with something else, leaving the rest of the cell untouched. In Excel 365, you can also feed SUBSTITUTE a range and the results spill into the cells below.
๐ŸŒ
Excel Champs
excelchamps.com โ€บ excel champs โ€บ excel formulas list โ€บ how to substitute multiple values (nested) in excel
How to Substitute Multiple Values (Nested) in Excel (Formula)
March 13, 2023 - The first INDEX function returns the value you want to replace from the range E1:E5, and the second INDEX gets the new value to replace with from the range F1:F5. ... Twelve years of teaching Excel, and a decade before that using it as a data ...