+ Reply to Thread
Results 1 to 4 of 4

If Statement for time

  1. #1
    Registered User
    Join Date
    11-01-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    If Statement for time

    Hi,
    I'm trying to put together a formula that I can apply to some spreadsheets.
    Here is an example of my data
    time hour
    14:00
    14:20
    14:40
    15:00
    15:20
    15:40
    16:00
    16:20
    16:40
    17:00

    I want to be able to us an IF statement to round down the data in my "time" column to the nearest hour and place that in the "hour" column. I have messed with this a bit but keep getting "invalid" errors. Here is what I tried,

    IF(OR($A$1=14:00,$A$1<15:00),14:00,IF(OR($A$1=15:00,$A$1<16:00)15,IF(OR(etc...

    any ideas?
    Thanks for the help!

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,213

    Re: If Statement for time

    Hi wtangow and welcome to the forum,

    Because you have 2010 Excel you have a function called MRound. I think this is what you need. Read about it at:
    http://excel.tips.net/T009359_Roundi...rter_Hour.html
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: If Statement for time

    Try FLOOR function to round down

    =FLOOR(A1,"1:00")

    ....or another way

    =HOUR(A1)/24

    format as time
    Audere est facere

  4. #4
    Registered User
    Join Date
    11-01-2011
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: If Statement for time

    Thank you for the quick response and I apologize for the late reply. Both suggestions were great. I ended up using the FLOOR method which was a huge help. Thanks again.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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