+ Reply to Thread
Results 1 to 7 of 7

If and or alternative funtion

  1. #1
    Registered User
    Join Date
    05-14-2014
    Location
    Kuwait
    MS-Off Ver
    Excel 2019
    Posts
    46

    If and or alternative funtion

    I have Shift Start and Shift End columns in excel sheet. I calculated shift hours by formula. i want to change this formula, based on the stautus column. if staus = "P" or "P/2" or "HLF" calculate it's shift hours hours. otherwise, other than any mentioned status don't calculate hours and show it as blank.
    Attached Files Attached Files

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

    Re: If and or alternative funtion

    Try this:

    =IF(OR([@Status]="P",[@Status]="P/2",[@Status]="HLF"),IF(([@[Shift End]]-[@[Shift start]])<0,1-([@[Shift start]]-[@[Shift End]]),([@[Shift End]]-[@[Shift start]])),"")
    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. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert XLent's Avatar
    Join Date
    10-13-2010
    Location
    Northumberland, UK
    MS-Off Ver
    various
    Posts
    2,706

    Re: If and or alternative funtion

    FWIW, you can shorten this to:

    =IF(OR([@Status]={"P","P/2","HLF"}),MOD([@[Shift End]]-[@[Shift start]],1),"")

  4. #4
    Registered User
    Join Date
    05-14-2014
    Location
    Kuwait
    MS-Off Ver
    Excel 2019
    Posts
    46

    Re: If and or alternative funtion

    Perfect... Thanks

  5. #5
    Registered User
    Join Date
    05-14-2014
    Location
    Kuwait
    MS-Off Ver
    Excel 2019
    Posts
    46

    Re: If and or alternative funtion

    Could you please add one more condition in this formula, that even status = p, p/2,hlf but their worked hours are blank, than shift hours should also be blank. Thanks in advance.

  6. #6
    Registered User
    Join Date
    05-14-2014
    Location
    Kuwait
    MS-Off Ver
    Excel 2019
    Posts
    46

    Re: If and or alternative funtion

    Could you please add one more condition in this formula, that even status = p, p/2,hlf but their worked hours are blank, than shift hours should also be blank. Thanks in advance.

  7. #7
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    19,043

    Re: If and or alternative funtion

    Perhaps the following modification to XLent's formula will help:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ 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] funtion error occurring when E:E is part of the funtion
    By delboy1616 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-12-2020, 10:21 AM
  2. how to lock or freeze today funtion and Now funtion
    By edwest01 in forum Excel General
    Replies: 2
    Last Post: 12-09-2018, 06:35 PM
  3. [SOLVED] If funtion help
    By kprabhupaul in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 07-28-2016, 12:23 PM
  4. =IF funtion
    By msdeenise in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-08-2008, 05:56 PM
  5. funtion help
    By jziggy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-11-2007, 02:02 PM
  6. If Funtion
    By David in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-29-2005, 04:10 PM
  7. If funtion help
    By fetzer in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 07-03-2005, 02:05 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