+ Reply to Thread
Results 1 to 6 of 6

Macro to find Max and Min time from the data

  1. #1
    Registered User
    Join Date
    10-01-2013
    Location
    India
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    7

    Macro to find Max and Min time from the data

    Hi Guy

    Daily At the end of day We receive sales files from our different teams, these files are received at different times due to difference in working shifts. I have collated last one month data and from this data I want to know the earliest and maximum time and date on which we received the files in last month, so that i can fix the receiving time for all regions.

    I am attaching sample file for your reference.

    I would appreciate if some one help me on this.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Macro to find Max and Min time from the data

    Array enter (enter using Ctrl-Shift-Enter)

    =MAX(A2:A10+B2:B10)
    and format the cell as date and time.

    For the earliest array enter

    =MIN(A2:A10+B2:B10)
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    10-01-2013
    Location
    India
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    7

    Re: Macro to find Max and Min time from the data

    Hi Bernie

    Thanks for you help and reply..

    The formula which you gave me {=MIN(A2:A10+B2:B10)} is perfectly working for dates, whereas its not working for the time.

    Your formula gives me the min time as 23:08 and Max time as 20:00.

    If you look at my file, the earliest time received was on 02Mar14 at 19:38. Whereas the maximum time was on 25Feb14 at 03:00 (Morning).


    I tried various formulas but its not working. Any help either through macros or formulas will be appreciated.

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: Macro to find Max and Min time from the data

    You said "Time and Date" - meaning that 10PM on the 1st is earlier than 10AM on the 2nd. If you just want the earliest and latest time separate from the date, use

    =MIN(B2:B20)
    =MAX(B2:B20)

    And since you don't care about time on date, just use

    =MIN(A2:A10)
    =MAX(A2:A10)

    But - and this is a big BUT - you say

    "earliest time received was on 02Mar14 at 19:38..the maximum time was on 25Feb14 at 03:00"

    So is the earliest time relative to a specific time of the day - like 17:00? So 17:01 would be the earliest, and 16:59 would be the latest?

    If that is the case, then use these array formulas, entered with Ctrl-Shift-Enter

    =MIN(IF(B2:B10<17/24,B2:B10+1,B2:B10))
    =MAX(IF(B2:B10<17/24,B2:B10+1,B2:B10))
    Last edited by Bernie Deitrick; 03-25-2014 at 09:53 AM.

  5. #5
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Macro to find Max and Min time from the data

    From reading the previous replies, I have tried to put all the choices in one workbook.
    Attached Files Attached Files
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  6. #6
    Registered User
    Join Date
    10-01-2013
    Location
    India
    MS-Off Ver
    Excel 2007 & Excel 2010
    Posts
    7

    Re: Macro to find Max and Min time from the data

    Thank You very much Bernie.

    This time your formula worked perfectly for me.

    I really appreciate the way you have responded. You were fast and quick.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find last row and change it every time macro runs
    By tedy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-28-2013, 08:45 AM
  2. Find Macro With Userform - To find a data across multiple tabs in excel
    By Testify in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-15-2012, 04:49 PM
  3. Macro to Find In Between Date/Time Values and use Text to Prompt Calculations
    By ExcelQuestFL in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-19-2010, 06:37 AM
  4. Formula to find time that data changes
    By sharronbrowne in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-21-2008, 06:29 PM
  5. Want to find time taken for the macro
    By psk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2005, 03:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1