+ Reply to Thread
Results 1 to 4 of 4

How to make a cell which has a conditional format sum with text in return as a 0

  1. #1
    Registered User
    Join Date
    02-10-2015
    Location
    Bristol, England
    MS-Off Ver
    MS Office 7
    Posts
    2

    How to make a cell which has a conditional format sum with text in return as a 0

    I have created a schedule which incorporates lunches automatically (either half hour or 1-hour lunches, depending on the circumstances).

    The schedule only has time in and time out, excel automatically deducts the lunch break depending on the circumstance:

    If you worked less than 6 hours = no lunch
    If you worked more than 6 hours, but less than or equal to 8 hours = 0.5 hour lunch
    If you worked more than 8 hours = 1 hour lunch

    The formula (which works) I’m using for this is:

    9:00 AM in A2 and 5:00 PM in B2 or 09:00 and 17:00

    =(B2-A2)*24-IF((B2-A2)*24>8,1,IF((B2-A2)*24>6,0.5,0))

    But…

    If I put any text in a cell, such as “HOL” or “OFF” to indicate Holiday or Day off the cell returns #VALUE – how do I make the cell return “0” if TEXT is applied to either A2 or A2 cells?

    Please help – I’m loosing the will to live!

    Many thanks

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to make a cell which has a conditional format sum with text in return as a 0

    Try

    =IF(COUNT(A2:B2)=2,(B2-A2)*24-IF((B2-A2)*24>8,1,IF((B2-A2)*24>6,0.5,0)),0)

  3. #3
    Registered User
    Join Date
    02-10-2015
    Location
    Bristol, England
    MS-Off Ver
    MS Office 7
    Posts
    2

    Re: How to make a cell which has a conditional format sum with text in return as a 0

    Awesome - thanks so much!!

    Just one more, for night shifts (where no break is deducted) i have the following formula

    =(MOD(B1-C1,1))*24, again how do I return it as a zero value if text is applied to cells B or C.
    Last edited by Richard Dkn; 02-11-2015 at 07:10 AM.

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to make a cell which has a conditional format sum with text in return as a 0

    Pretty much the same way..

    =IF(COUNT(B1:C1)=2,MOD(B1-C1,1)*24,0)

+ 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] Conditional Formatting - Make cell the same format as another
    By Harlequin in forum Excel General
    Replies: 4
    Last Post: 07-12-2013, 03:22 AM
  2. make conditional format the real cell pattern
    By Hein in forum Excel General
    Replies: 2
    Last Post: 10-15-2010, 01:18 PM
  3. conditional format formula for make cell highlight
    By johncena in forum Excel General
    Replies: 2
    Last Post: 04-27-2010, 03:54 AM
  4. Make conditional formatting Macro dependent on cell number format
    By jbyrne in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-15-2010, 10:26 AM
  5. How to make a cell return the formatted value in a text string (i.
    By n.almeida in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-02-2005, 10:06 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