Akshat Gupta
Akshat Gupta

Reputation: 1

Finding minimum and maximum values from range of values

I have an excel with the following data -

Value   Date    Time
0   1-May-16    11:20 AM
0   1-May-16    12:05 PM
0   1-May-16    11:30 AM
0   5-May-16    3:40 PM
1   3-May-16    1:00 AM
1   2-May-16    1:45 AM
0   1-May-16    6:04 AM
0   4-May-16    7:09 AM
0   5-May-16    8:20 PM
2   5-May-16    1:53 AM
2   1-May-16    2:54 AM
3   1-May-16    7:35 PM
3   4-May-16    8:34 AM
4   5-May-16    2:12 PM
0   2-May-16    12:11 PM
5   1-May-16    12:45 PM
5   3-May-16    4:55 AM
5   3-May-16    1:12 AM

I need to summarize my data by value column with min and max date and time for each value.

The output of the above data should look like this -

    Min     Max 
    Date    Time    Date    Time
0   1-May-16    11:20 AM    5-May-16    3:40 PM
1   2-May-16    1:45 AM 3-May-16    1:00 AM
2   1-May-16    2:54 AM 5-May-16    1:53 AM
3   1-May-16    7:35 PM 4-May-16    8:34 AM
4   5-May-16    2:12 PM 5-May-16    2:12 PM
5   3-May-16    1:12 AM 3-May-16    4:55 AM

Please help

Upvotes: 0

Views: 38090

Answers (1)

Dani Costa
Dani Costa

Reputation: 43

try this:

Set range from which to determine smallest value
Set rng = Sheet1.Range("A1:Z100")

'Worksheet function MIN returns the smallest value in a range 
dblMin = Application.WorksheetFunction.Min(rng)

From:

http://www.globaliconnect.com/excel/index.php?option=com_content&view=article&id=105:find-smallest-and-largest-value-in-range-with-vba-excel&catid=79&Itemid=475

Upvotes: 3

Related Questions