Extract highest number

T

Tech_Wolf

ok, I need to write a formula that will check a cell with several words and
numbers in it, take the highest number is that cell, and display it in a
seperate cell as a numerical value, so other formulas can use it. How can I
accomplish this?
 
R

Ron Rosenfeld

ok, I need to write a formula that will check a cell with several words and
numbers in it, take the highest number is that cell, and display it in a
seperate cell as a numerical value, so other formulas can use it. How can I
accomplish this?

Provide some examples of data and desired output, in a way that demonstrates
the types of numbers and formats you might be dealing with.
--ron
 
L

Lori

If your text is in A1, maybe try this *array* formula in B1:

=MAX(--(TEXT(MID(A1,COLUMN(A:IV),{1;2;3;4;5;6;7;8;9;10}),"0;0;0;\0")&" 0/1"))

executed using with CTRL+SHIFT+ENTER not just enter. This extracts a
positive whole number up to 10 digits and returns 0 if none is found. (You
could add a few more numbers to get up to 15 digit numbers which is the limit
of Excel's precision but for larger numbers you'd need to use a text UDF.)
 
T

Tech_Wolf

Ok, in cell E3-Ex (as many cells as user needs), there will be imput along
these lines: Acidosis, severe [5], Anemia, moderate [3].
I need to somehow automatically extract the highest numerical value from
that imput and place it into cell G3-Gx, where from it will be operated on by
some math formulas.
 
R

Ron Rosenfeld

Ok, in cell E3-Ex (as many cells as user needs), there will be imput along
these lines: Acidosis, severe [5], Anemia, moderate [3].
I need to somehow automatically extract the highest numerical value from
that imput and place it into cell G3-Gx, where from it will be operated on by
some math formulas.

Since these numbers are all relatively small integers, Lori's formula will work
well.
--ron
 
L

Lori

If you're only looking for numbers 1-5 enclosed in [ ], maybe try in G3:

=MATCH(4^8,FIND("["&{1,2,3,4,5}&"]",E3))

then fill across.

Tech_Wolf said:
Ok, in cell E3-Ex (as many cells as user needs), there will be imput along
these lines: Acidosis, severe [5], Anemia, moderate [3].
I need to somehow automatically extract the highest numerical value from
that imput and place it into cell G3-Gx, where from it will be operated on by
some math formulas.

Ron Rosenfeld said:
Provide some examples of data and desired output, in a way that demonstrates
the types of numbers and formats you might be dealing with.
--ron
 
L

Lori

Glad this was helpful too. Can't remember where/who the idea came from.

&" 0/1" is misplaced though, it should actually be inside the TEXT function
just before the last comma. Appending a fractional part of zero ensures all
non-integer values in the text are ignored (dates, times, exponentials, etc.)
&"e0" would include decimals and thousand separators in the result too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top