Combining REPLACE with SUM in one cell

DiceCoDude

New Member
Joined
Oct 1, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
I'm trying what I suspect is far easier than I'm making it.
I'm attempting to decrement the following cell by 4:
interface g1/0/5
the new text will be:
interface g1/0/1
I've tried a few ways with only slight success but I think this one is on the right track:
=REPLACE(A2, 16, 1, "?" ) - The question mark shows where I'm lost. I want to replace position 16 ("5" in this case) with the sum of position 16 - 4. Then I can drag the formula down the rest of my spreadsheet. This is a network switch configuration so I have to repeat this replace formula 240 times for each data closet, so... 48,000 times? I'm trying to find a way to save many hours of tedious work. MUCH appreciated.
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hi & welcome to MrExcel.
Maybe
Excel Formula:
=REPLACE(A2,16,1,MID(A2,16,1)-4)
 
Upvote 0
Is the last number is always one character?
 
Upvote 0
In that case how about
Excel Formula:
=REPLACE(A2,16,2,MID(A2,16,2)-4)
 
Upvote 0
Solution
Hi & welcome to MrExcel.
Maybe
Excel Formula:
=REPLACE(A2,16,1,MID(A2,16,1)-4)
That is absolutely beautiful! Thank you. But to JECs point, I failed to mention that it'll grow to 2 characters. This formula works, but as expected when it grows you get this on gi1/0/10 "interface g1/0/-30". My fault!
 
Upvote 0
See post#5, we posted about the same time.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top