I'm wanting to update a column based on another that has drill holes listed in sequence, the update needs to replace a character within the sequence, such that A = 0, B = 1, C = 2 etc... Is there a way to do this without writing a really big IF/Then type formula?
I've tried the replace formula, but I've only managed to update one letter at a time..
In the example below; The Hole_ID_2 (column R) is the desired output using the Hole_ID (Column P) data.
Any help will be appreciated, cheers
As long as all IDs to replace are of the same structure (10 characters in length and the letter to replace at position 8), one could get the ANSI
code of the letter using CODE
and calculate that code to the appropriate number then.
That would avoid many nested SUBSTITUTE
functions.
Your Example:
Formula in R3
downwards:
=LEFT(P3,7)&CODE(MID(P3,8,1))-65&RIGHT(P3,2)
Just to give you another option:
=SUBSTITUTE(RIGHT(P3,LEN(P3)-1),MID(P3,MID(1,ISERROR(VALUE(MID(RIGHT(P3,LEN(P3)-1),ROW(INDIRECT("1:"&LEN(P3))),1)))*1,0)+1,1),CODE(MID(P3,MATCH(1,ISERROR(VALUE(MID(RIGHT(P3,LEN(P3)-1),ROW(INDIRECT("1:"&LEN(P3))),)))*1,0)+1,1))-65)
It looks a bit scary but it just substitutes the first non numerical character found in the string without taking into acount the first N
. Its an array formula so it should be entered as such!
It will be more dynamic as it doesn't matter where the non-numerical character is placed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.