+ Reply to Thread
Results 1 to 5 of 5

formula for returning am or pm from a time

  1. #1
    Forum Contributor
    Join Date
    02-24-2017
    Location
    london
    MS-Off Ver
    OFFICE 365
    Posts
    105

    formula for returning am or pm from a time

    i have a spread sheet with time in cell a4, the following formula returns whether it is AM or PM

    =IF(A4<0.5,"AM","PM")

    but i want the cell to remain blank if nothing is entered in cell a4

    i have tried
    =IF(A4,(A4<0.5,"AM","PM"),"with no success

    any ideas ?????

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: formula for returning am or pm from a time

    Try

    =IF(A4<>"",IF(A4<0.5,"AM","PM"),"")
    Martin

  3. #3
    Forum Contributor
    Join Date
    02-24-2017
    Location
    london
    MS-Off Ver
    OFFICE 365
    Posts
    105

    Re: formula for returning am or pm from a time

    Thank you that worked a treat your a star

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

    Re: formula for returning am or pm from a time

    You can also use TEXT function here, e.g.

    =TEXT(A4,"AM/PM;;")
    Audere est facere

  5. #5
    Forum Contributor
    Join Date
    02-24-2017
    Location
    london
    MS-Off Ver
    OFFICE 365
    Posts
    105

    Re: formula for returning am or pm from a time

    Thanks Daddylonglegs just tried that and it works you have both made it look easy i was tearing my hair out any help is much appreciated thank you

+ 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. [SOLVED] Returning a value based on time
    By uvebeenwarrened in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-30-2017, 02:54 PM
  2. [SOLVED] VBA for Inserting Formula returning Run-time error '1004'
    By blwager in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-18-2013, 08:50 PM
  3. Returning a Value in Time Format
    By heresteve2 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-30-2013, 04:16 PM
  4. need one formula for returning positive or negative time w/out #######
    By completelyhis in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 05-11-2013, 09:12 AM
  5. Vlookup returning #NA with Time
    By cadge in forum Excel General
    Replies: 6
    Last Post: 01-20-2012, 07:51 AM
  6. Formula sometimes returning correct answer and sometimes returning 0
    By redimp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2010, 06:28 AM
  7. Returning the Time part from NOW()
    By ElmerS in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-08-2010, 04:07 AM

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