ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count number of values (https://www.excelbanter.com/excel-programming/326428-count-number-values.html)

DS NTE

Count number of values
 
In a cell I have this values

;1,23;2,5;5,5;6,5; etc......

How can I, using VBA count how many values there are, separated by ;
(semicolon)


Knut Egil



Bob Phillips[_6_]

Count number of values
 
=LEN(A1)-LEN(SUBSTITUTE(A1,";","")).

If there is an ; at start and finish, just subtract one. If there are
neither, add 1.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DS NTE" wrote in message
...
In a cell I have this values

;1,23;2,5;5,5;6,5; etc......

How can I, using VBA count how many values there are, separated by ;
(semicolon)


Knut Egil





RC-

Count number of values
 
Using VBA

Private Sub CountMeUP()
Dim MyNumber As Integer
Dim MyValue As String
Dim MyArray As Variant

MyValue = ActiveCell.Value

MyArray = Split(MyValue, ";")

MyNumber = UBound(MyArray)


End Sub


HTH


"Bob Phillips" wrote in message
...
=LEN(A1)-LEN(SUBSTITUTE(A1,";","")).

If there is an ; at start and finish, just subtract one. If there are
neither, add 1.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"DS NTE" wrote in message
...
In a cell I have this values

;1,23;2,5;5,5;6,5; etc......

How can I, using VBA count how many values there are, separated by ;
(semicolon)


Knut Egil







RC-

Count number of values
 
Sorry for the double post

Using VBA

Private Sub CountMeUP()
Dim MyNumber As Integer
Dim MyValue As String
Dim MyArray As Variant

MyValue = ActiveCell.Value

MyArray = Split(MyValue, ";")

MyNumber = UBound(MyArray)


End Sub


HTH


"DS NTE" wrote in message
...
In a cell I have this values

;1,23;2,5;5,5;6,5; etc......

How can I, using VBA count how many values there are, separated by ;
(semicolon)


Knut Egil




DS NTE

Count number of values
 
Thank you !!!!
Works perfectly!!!

knut egil
"RC-" skrev i melding
...
Sorry for the double post

Using VBA

Private Sub CountMeUP()
Dim MyNumber As Integer
Dim MyValue As String
Dim MyArray As Variant

MyValue = ActiveCell.Value

MyArray = Split(MyValue, ";")

MyNumber = UBound(MyArray)


End Sub


HTH


"DS NTE" wrote in message
...
In a cell I have this values

;1,23;2,5;5,5;6,5; etc......

How can I, using VBA count how many values there are, separated by ;
(semicolon)


Knut Egil







All times are GMT +1. The time now is 05:33 PM.

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