ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   return largest number of a list of numbers in the same cell (https://www.excelbanter.com/excel-worksheet-functions/48690-return-largest-number-list-numbers-same-cell.html)

Hells

return largest number of a list of numbers in the same cell
 
Hello,

Can anyone help me, I wish to return the higest number in a string of
numbers (all in the same cell) seperated by commas.

Thanks

Gary''s Student

1. locate an un-used row of cells
2. use Tools Text to Columns... to separate the list into cells from step #1
3. use the MAX() function to get the largest value.
--
Gary''s Student


"Hells" wrote:

Hello,

Can anyone help me, I wish to return the higest number in a string of
numbers (all in the same cell) seperated by commas.

Thanks


Bernie Deitrick

You would need to use a User-Defined-Function - see code below.

Used like

=myMax(A1)

HTH,
Bernie
MS Excel MVP


Function myMax(incell As Range) As Double
Dim myArr As Variant
Dim myDbl() As Double
Dim i As Integer
myArr = Split(incell.Value, ",")
ReDim myDbl(LBound(myArr) To UBound(myArr))
For i = LBound(myArr) To UBound(myArr)
myDbl(i) = CDbl(myArr(i))
Next i
myMax = Application.Max(myDbl)
End Function


"Hells" wrote in message
...
Hello,

Can anyone help me, I wish to return the higest number in a string of
numbers (all in the same cell) seperated by commas.

Thanks





All times are GMT +1. The time now is 08:30 AM.

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