|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Other Language - Excel Search & Replace Question
Is it possible in Microsoft Excel to perform a search and replace on a column of information that accomplishes the following:
S5-B1 -> S5-B01 S5-B2 -> S5-B02 S5-B3 -> S5-B03 S5-B4 -> S5-B04 I'm basically looking to force the single digit after the letter "B" to be a minimum of 2 digits wide. Any suggestions would be appreciated. |
|
#2
|
||||
|
||||
|
Not with search and replace I don't think but its simple enough with a little VBA. This function would convert the first four characters + zero pad (to two) the last number(s)
Code:
Public Function ConvertCol(strIn As String) As String
ConvertCol = Left(strIn, 4) + Format(Right(strIn, Len(strIn) - 4), "00")
End Function
You can then use it as a worksheet function, e.g. the formula in B1 might be: =ConvertCol(A1)
__________________
medialint.com "Energy has the opportunity to change the climate if it's done right." - Sen. John Ensign, R-Nev. (quoted out of context) |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Other Language - Excel Search & Replace Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|