Re: $$Excel-Macros$$ Minimum & Maximum value of a Cell

2012-01-31 Thread Sam Mathai Chacko
Why would you even need such a large UDF. This should do it.

Function MAXVAL(strTEXT As String) As Long
Dim lngLoop As Long
For lngLoop = 1 To Len(strTEXT)
MAXVAL = Application.Max(1 * IIf(IsNumeric(Mid(strTEXT, lngLoop,
1)), Mid(strTEXT, lngLoop, 1), 0), MAXVAL)
Next lngLoop
End Function

Function MINVAL(strTEXT As String) As Long
Dim lngLoop As Long
MINVAL = 9
For lngLoop = 1 To Len(strTEXT)
MINVAL = Application.Min(1 * IIf(IsNumeric(Mid(strTEXT, lngLoop,
1)), Mid(strTEXT, lngLoop, 1), 0), MINVAL)
Next lngLoop
End Function

If you need a formula,

=MAX(--MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)) as CSE, similar to Rajan's,
will also work.

Regards,

Sam Mathai Chacko

On Tue, Jan 31, 2012 at 12:09 PM, NOORAIN ANSARI
wrote:

> Dear Pravesh,
>
> Try it..UDF
>
> *For Minimum Value..*.
>
> Function Minval(x As String)
> Dim i As Integer, minx As Integer
> For i = 1 To Len(x)
> If IsNumeric(Mid(x, i, 1)) Then
> minx = Mid(x, i, 1)
> Exit For
> End If
> Next
> For i = 1 To Len(x)
> If IsNumeric(Mid(x, i, 1)) Then
> If Mid(x, i, 1) < minx Then
> minx = Mid(x, i, 1)
> End If
> End If
> Next i
> Minval = minx
> End Function
> *For Maximum Value*
> Function Maxval(x As String)
> Dim i As Integer, maxx As Integer
> For i = 1 To Len(x)
> If IsNumeric(Mid(x, i, 1)) Then
> maxx = Mid(x, i, 1)
> Exit For
> End If
> Next
> For i = 1 To Len(x)
> If IsNumeric(Mid(x, i, 1)) Then
> If Mid(x, i, 1) > maxx Then
> maxx = Mid(x, i, 1)
> End If
> End If
> Next i
> Maxval = maxx
> End Function
> See attached sheet
> --
>  Thanks & regards,
> Noorain Ansari
>  *http://excelmacroworld.blogspot.com/*
> *http://noorain-ansari.blogspot.com/*
>
> On Tue, Jan 31, 2012 at 9:42 AM, PRAVESH KUMAR 
> wrote:
>
>> Hi Group,
>>
>> I need to extract min & max value of a cell.
>> Sample sheet is attached herewith.
>> Thanks in advance.
>>
>> With Regards,
>> Pravesh
>>
>> --
>> FORUM RULES (986+ members already BANNED for violation)
>>
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>> will not get quick attention or may not be answered.
>>
>> 2) Don't post a question in the thread of another member.
>>
>> 3) Don't post questions regarding breaking or bypassing any security
>> measure.
>>
>> 4) Acknowledge the responses you receive, good or bad.
>>
>> 5) Cross-promotion of, or links to, forums competitive to this forum in
>> signatures are prohibited.
>>
>> NOTE : Don't ever post personal or confidential data in a workbook. Forum
>> owners and members are not responsible for any loss.
>>
>>
>> --
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>
>
>  --
> FORUM RULES (986+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5) Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
>
> --
> To post to this group, send email to excel-macros@googlegroups.com
>



-- 
Sam Mathai Chacko

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com


Re: $$Excel-Macros$$ Minimum & Maximum value of a Cell

2012-01-30 Thread NOORAIN ANSARI
Dear Pravesh,

Try it..UDF

*For Minimum Value..*.

Function Minval(x As String)
Dim i As Integer, minx As Integer
For i = 1 To Len(x)
If IsNumeric(Mid(x, i, 1)) Then
minx = Mid(x, i, 1)
Exit For
End If
Next
For i = 1 To Len(x)
If IsNumeric(Mid(x, i, 1)) Then
If Mid(x, i, 1) < minx Then
minx = Mid(x, i, 1)
End If
End If
Next i
Minval = minx
End Function
*For Maximum Value*
Function Maxval(x As String)
Dim i As Integer, maxx As Integer
For i = 1 To Len(x)
If IsNumeric(Mid(x, i, 1)) Then
maxx = Mid(x, i, 1)
Exit For
End If
Next
For i = 1 To Len(x)
If IsNumeric(Mid(x, i, 1)) Then
If Mid(x, i, 1) > maxx Then
maxx = Mid(x, i, 1)
End If
End If
Next i
Maxval = maxx
End Function
See attached sheet
-- 
 Thanks & regards,
Noorain Ansari
 *http://excelmacroworld.blogspot.com/*
*http://noorain-ansari.blogspot.com/* 

On Tue, Jan 31, 2012 at 9:42 AM, PRAVESH KUMAR wrote:

> Hi Group,
>
> I need to extract min & max value of a cell.
> Sample sheet is attached herewith.
> Thanks in advance.
>
> With Regards,
> Pravesh
>
> --
> FORUM RULES (986+ members already BANNED for violation)
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
>
> 2) Don't post a question in the thread of another member.
>
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
>
> 4) Acknowledge the responses you receive, good or bad.
>
> 5) Cross-promotion of, or links to, forums competitive to this forum in
> signatures are prohibited.
>
> NOTE : Don't ever post personal or confidential data in a workbook. Forum
> owners and members are not responsible for any loss.
>
>
> --
> To post to this group, send email to excel-macros@googlegroups.com
>

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com


query(Solved).xlsm
Description: Binary data


RE: $$Excel-Macros$$ Minimum & Maximum value of a Cell

2012-01-30 Thread Rajan_Verma
For  Min

=MIN(INT(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)))

For Max

=MAX(INT(MID(A2,ROW(INDIRECT("1:"&LEN(A2))),1)))

 

Use with CSE

 

Rajan.

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of PRAVESH KUMAR
Sent: Jan/Tue/2012 09:42
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Minimum & Maximum value of a Cell

 

Hi Group,

I need to extract min & max value of a cell.
Sample sheet is attached herewith.

Thanks in advance.

 

With Regards,

Pravesh

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security
measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
 

--
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com


$$Excel-Macros$$ Minimum & Maximum value of a Cell

2012-01-30 Thread PRAVESH KUMAR
Hi Group,

I need to extract min & max value of a cell.
Sample sheet is attached herewith.
Thanks in advance.

With Regards,
Pravesh

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

--
To post to this group, send email to excel-macros@googlegroups.com


query(1).xlsm
Description: Binary data