+ Reply to Thread
Results 1 to 22 of 22

IF STATEMENT with time.

  1. #1
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    IF STATEMENT with time.

    Hello,

    Need help with a multiple IF statement. This cell is TIME =0:53:46 ( so 53 minutes and 46 seconds).

    I want to group the results into a few categories. Under 5 minutes, 10 - 20 min, 20 - 30min and 30+ minutes.

    Please help. Thanks!

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    What do you mean by 'group'? What does your raw data look like? What do your expected outcomes look like?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    =IF(AE2<=0:05:00,"0-5",IF(AE2<=0:10:00,"5-10",IF(AE2<=0:20:00,"10-20",IF(AE2>0:20:01,">20"))))

    this is what I have but its not working...

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    That's not what I asked to see. Review my previous post and provide the information requested there, please. Attach a workbook if it is easier.

  5. #5
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    Quote Originally Posted by AliGW View Post
    That's not what I asked to see. Review my previous post and provide the information requested there, please. Attach a workbook if it is easier.
    Disregard the word "Group". Raw data example already included. A column with h:mm:ss (0:53:46, 0:10:01,etc)... the outcome i want is based on the IF statement above....

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    OK - you don't seem to be understanding what I'm asking for.

    Will you please attach a sample Excel workbook? We are not able to work with or manipulate a picture or a description of one.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.

  7. #7
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    wow, with over 2 years on these forums - never had a problem. Haha dont take this too seriously, the people responding to the inquires will easily understand my issue. I have provided the ALL the necessary data for someone to answer my issue and provided my version of an attempted formula but requires some tweaking. The OUTCOME is listed in the formula if you read it carefully, but more so understand it. The IF statement has quotations " " and that usually signifies the outcome to be displayed in the cell

    Happy New Years

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    OK - here's a guess:

    =IF(E8<=TIME(0,5,0),"0-5",IF(E8<=TIME(0,10,0),"5-10",IF(E8<=TIME(0,20,0),"10-20",IF(E8>TIME(0,20,1),">20"))))

    Change the cell references to suit.

    If that's not what you mean, then please attach a workbook.

  9. #9
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    Unfortunately that did not work. The results appeared >20 for all of them - so it didnt understand the time.

    TIME COLUMN
    0:53:46
    0:10:50
    0:07:07

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    It is working fine here with the three times you have listed. Would you like me to have a look at your workbook?

    Excel 2016 (Windows) 32 bit
    E
    F
    8
    00:53:46
    >20
    9
    00:10:50
    10-20
    10
    00:07:07
    5-10
    Sheet: Sheet1

    Excel 2016 (Windows) 32 bit
    F
    8
    =IF(E8<=TIME(0,5,0),"0-5",IF(E8<=TIME(0,10,0),"5-10",IF(E8<=TIME(0,20,0),"10-20",IF(E8>TIME(0,20,1),">20"))))
    Sheet: Sheet1
    Last edited by AliGW; 12-29-2016 at 12:54 PM.

  11. #11
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    Have you checked that the time column is not formatted as text?

  12. #12
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    it was pasted as a value.. so its formatted as GENERAL.

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    Then they are text. I'll show you what I mean. Hang on.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    Have a look at this:

    Excel 2016 (Windows) 32 bit
    B
    C
    D
    E
    2
    00:53:46
    Copied from your post
    0.037338
    Copied as values
    3
    00:10:50
    with just copy & paste
    0.007523
    & formatting comes in
    4
    00:07:07
    & formatting comes in
    0.004942
    as general
    5
    as custom (time)
    Sheet: Sheet1

  15. #15
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    I literally have this.. if you paste it into an excel right now

    A B
    0:53:46 >20
    0:10:50 >20
    0:07:07 >20
    4:45:12 >20
    4:02:50 >20

    with the following formula

    =IF(A5<=TIME(0,5,0),"0-5",IF(A5<=TIME(0,10,0),"5-10",IF(A5<=TIME(0,20,0),"10-20",IF(A5>TIME(0,20,1),">20"))))

  16. #16
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    As you have instructed me to do:

    Excel 2016 (Windows) 32 bit
    A
    B
    1
    00:53:46
    >20
    2
    00:10:50
    10-20
    3
    00:07:07
    5-10
    4
    04:45:12
    >20
    5
    04:02:50
    >20
    Sheet: Sheet2

    Now, would you like me to have a look at your file (or a sample version of it)?

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    Are your times showing flush left or right in the cell? What do you get with this formula in any free cell?

    =VALUE(A1)

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    Just so that you are aware, I'll be going offline within the next half an hour - it's almost 6pm here - so if you do want me to look at the file or a sample of it, please upload it as soon as you can. It would be nice to resolve this after over two hours of trying!

    However, it looks as if you have gone offline now, so maybe someone else will have a look at your file for you when you come back. If your issue has been resolved in the meantime, then please mark the thread as solved using the thread tools at the top. Thanks!
    Last edited by AliGW; 12-29-2016 at 01:33 PM.

  19. #19
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    Quote Originally Posted by AliGW View Post
    Are your times showing flush left or right in the cell? What do you get with this formula in any free cell?

    =VALUE(A1)
    when I do that for the first one

    A
    0:53:46

    the result is 0.037337963
    when i convert that ^ to time i get 12:53:46 AM

    but thats incorrect because what my column should indicate is 53 minutes and 46 seconds.

    Thanks

  20. #20
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: IF STATEMENT with time.

    This shows that the data you have is not displaying properly as time, even though it looks as if it is. You seem reluctant to post the workbook here, but if you change your mind and it still hasn't been resolved in the morning, I'll take a look then. I am away from my computer now, unfortunately.

  21. #21
    Registered User
    Join Date
    03-23-2015
    Location
    toronto
    MS-Off Ver
    2010
    Posts
    52

    Re: IF STATEMENT with time.

    I tried posting the worksheet here multiple times but keep getting an error so I continued posting as much info I can.

  22. #22
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: IF STATEMENT with time.

    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to Quick Post button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

+ 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. IF statement involving time subtraction versus entered time data
    By JasonTran in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-08-2016, 11:43 AM
  2. [SOLVED] IF statement on data validation, End time greater than Start time
    By Faridwahidi in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-02-2014, 08:04 AM
  3. Replies: 4
    Last Post: 03-14-2014, 07:08 AM
  4. If statement to determine if time value is higher than another time value
    By xtort81 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-15-2013, 03:48 PM
  5. If Statement for time
    By wtangow in forum Excel General
    Replies: 3
    Last Post: 11-15-2011, 11:38 AM
  6. If Statement for Time (hh:mm)
    By lukela85 in forum Excel General
    Replies: 2
    Last Post: 09-24-2010, 01:58 PM
  7. If time Statement
    By Lix in forum Excel General
    Replies: 3
    Last Post: 03-07-2007, 01:19 AM

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