View Full Version : [SLEEPER:] Removing First few characters of a String
Banixxx
12-13-2007, 02:04 PM
I have a string in the following format
A = First Intial of First Name
XXX = Last name
fts_aXXXXX
I want to Remove the FTS_A and just leave the last name any suggestions on who to do this as im not familar how to do this in VBA
Thnx
Banixxx
12-13-2007, 02:09 PM
I have a string in the following format
A = First Intial of First Name
XXX = Last name
fts_aXXXXX
I want to Remove the FTS_A and just leave the last name any suggestions on who to do this as im not familar how to do this in VBA
Thnx
Or Possible if i have a Table sheet called like "List" in which Column A is the "FTS_" name and Column B would be their First and last name.
have it compare this value in Sheet1 to the Sheet-List and find the matching cell in Column A and replace Sheet1 value with Column B from the List Sheet
To do it in VBA code, use this:
strString = Right(strString, Len(strString) - 5)
From a worksheet cell:
=REPLACE(A1,1,5,"")
unmarkedhelicopter
12-13-2007, 02:51 PM
I just LOVE questions like this, as Dr.K has given a precise and perfectly good answer ... but I bet it's not as simple as that (I hope I'm wrong) I bet that a) it's not a constant 5 characters to remove. b) the letter after the underscore is sometimes more than one. or it's both
Dr.K :- nice use of replace() shows how different it is from the VBA equivalent
Bob Phillips
12-13-2007, 03:52 PM
I agree with UMH, even if it SHOULD always be 5, never assume
=MID(A1,IF(ISNUMBER(FIND("_",A1)),FIND("_",A1)+2,1),99)
Banixxx
12-13-2007, 07:21 PM
Well If you all read the Post you would know the answer. HEHE :).
Is starts with "FTS_" then the letter A is to represent the First initial of that person name and XXX represent their entire last name
Example:
My name is Loren Dorez
so...
fts_ldorez and i want it to remove the fts_l using VBA to just have Dorez. Now the better questions would b would it be better to use a table that can be update with to columns linkin a FTS_AXXX screen name to a last name that way there is no confusion if there are 2 joe SMith one may be FTS_jmSmith and the other FTS_jSmith? How would i do it b y searching a 2coulmn table (A:B) and when it finds the value move over a cell copy and then past it inot the cell it found the FTS_AXXX name?
mikerickson
12-13-2007, 07:25 PM
=MID(A1,6,200)
LastName = Mid(MixedName,6)
unmarkedhelicopter
12-14-2007, 02:08 AM
Well If you all read the Post you would know the answer. HEHE :).
Is starts with "FTS_" then the letter A is to represent the First initial of that person name and XXX represent their entire last name
Example:
My name is Loren Dorez
so...
fts_ldorez and i want it to remove the fts_l using VBA to just have Dorez. Now the better questions would b would it be better to use a table that can be update with to columns linkin a FTS_AXXX screen name to a last name that way there is no confusion if there are 2 joe SMith one may be FTS_jmSmith and the other FTS_jSmith? How would i do it b y searching a 2coulmn table (A:B) and when it finds the value move over a cell copy and then past it inot the cell it found the FTS_AXXX name?Wow, what a way to NOT clarify the question !!!
Bob Phillips
12-14-2007, 02:29 AM
Is there a question in that lot?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.