ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   separating text and numbers into different columns (https://www.excelbanter.com/excel-programming/453156-separating-text-numbers-into-different-columns.html)

Paul Doucette

separating text and numbers into different columns
 
If I have sv14 in a cell, is there a formula I can use to copy the text characters into one column and the number into another? The number of text characters and number of numerical digits could vary. (however it is a limited list of text characters that would proceed the digits. It would always start with one of the following:
b
v
h
s
d
db
e
s
sv
sh
c
cv
ch
f
pb
pk
po
code
(yes "code" is one of the text strings)
Thank you in advance! Paul

isabelle

separating text and numbers into different columns
 
Hi Paul,

If there is no decimal

Function TXT(cel As Range)
Dim x As String, i As Integer, n
For i = 1 To Len(cel)
x = Asc(StrConv(Mid(cel, i, 1), vbLowerCase))
If x = 97 And x <= 122 Then
t = t & Mid(cel, i, 1)
End If
Next
TXT = t
End Function

Function NUMBER(cel As Range)
Dim x As String, i As Integer, n
For i = 1 To Len(cel)
x = Asc(StrConv(Mid(cel, i, 1), vbLowerCase))
If x = 49 And x <= 57 Then
n = n & Mid(cel, i, 1)
End If
Next
NUMBER = n * 1
End Function

isabelle

Le 2017-02-20 Ã* 18:23, Paul Doucette a écrit :
If I have sv14 in a cell, is there a formula I can use to copy the text
characters into one column and the number into another? The number of text
characters and number of numerical digits could vary. (however it is a
limited list of text characters that would proceed the digits. It would
always start with one of the following: b v h s d db e s sv sh c cv ch f pb
pk po code (yes "code" is one of the text strings) Thank you in advance!
Paul



All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com