+ Reply to Thread
Results 1 to 11 of 11

Total Hours by using formulas and conditional formatting

  1. #1
    Registered User
    Join Date
    12-05-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    88

    Total Hours by using formulas and conditional formatting

    Dear Experts,

    I am new here. I have uploaded the excel spreadsheets for you.

    The questions are inside of the spreadsheet.

    Hope to hear from you soon.

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Total Hours by using formulas and conditional formatting

    Looks like you're asking how to convert substrings to numbers for conditional formatting.

    Given your example, meaning using the range in it, select B6:K9 with B9 the active cell, then use the conditional formatting FORMULAS

    For red background
    =MATCH(--LEFT(B6&0,FIND("H",B6&"0H")-1),{0;350;400})=3

    For yellow background
    =MATCH(--LEFT(B6&0,FIND("H",B6&"0H")-1),{0;350;400})=2

  3. #3
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,450

    Re: Total Hours by using formulas and conditional formatting

    Sorry for off-topic interjection:

    Although there is no official rule regarding this behavior, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand, and we look forward to seeing you post your formulas/macros in your posts for the searching benefit of all.

    Thanks again for all your hard work here!

  4. #4
    Registered User
    Join Date
    12-05-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    88

    Re: Total Hours by using formulas and conditional formatting

    Hi Hrlngrv,

    Thank you for your reply. I'm going to try to explain in depth.
    May we first show the red cell?
    As I tried to use your formula codes in the conditional formatting and choose "Use a formula to determine which cells to format" but it doesn't show cells that are more than 400H or higher.

    Image attached: picture 2.PNG and picture.PNG

    The aim of this is to automatically show the red cell when I turn on the car machine hours like 450H63M.
    The table is going to expand while I key through.
    From my first post you can use my Excel attachment to display the correct formulas.

    Post to me, if you can't understand my reasoning.
    Attached Images Attached Images
    Last edited by fgfgicare; 03-10-2020 at 09:42 PM. Reason: pictures

  5. #5
    Registered User
    Join Date
    12-05-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    88

    Re: Total Hours by using formulas and conditional formatting

    Hi Pepe,

    Thank you very much for your feedback.
    I'm going to try to explain all of my posts in detail in the future.

  6. #6
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Total Hours by using formulas and conditional formatting

    Sorry. I screwed up in my previous response. B6 should be the active cell when you apply the conditional formatting formula.

  7. #7
    Registered User
    Join Date
    12-05-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    88

    Re: Total Hours by using formulas and conditional formatting

    Hi hrlngrv,

    Could you search where I'm wrong because I paste the code into the conditional formatting and it's still unloading the red cell?

    I have the Excel workbook uploaded.

    Thank you.
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Total Hours by using formulas and conditional formatting

    This time I tested. Can't use array constants in conditional formatting formulas, so necessary to use a defined name. I added thresholds referring to ={0;350;400}. Then I changed the conditional formatting formulas to

    For red background
    =MATCH(--LEFT(B6&0,FIND("H",B6&"0H")-1),thresholds)=3

    For yellow background
    =MATCH(--LEFT(B6&0,FIND("H",B6&"0H")-1),thresholds)=2
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    12-05-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    88

    Re: Total Hours by using formulas and conditional formatting

    Hi hrlngrv
    Thank you for the test and it works well.

    I have one question that I have added to the yellow highlighted picture Attachment 666913
    The first question, why is there a # REF? Was it an mistake of reference?

    If there is a # REF error, what should I do to make it smooth?

    Hope to hear from you.

  10. #10
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Total Hours by using formulas and conditional formatting

    There are #REF! errors in defined names in your workbook attachment in #7. I have no way to correct those.

  11. #11
    Registered User
    Join Date
    12-05-2019
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    88

    Re: Total Hours by using formulas and conditional formatting

    Hi hrlngrv,

    Ooops, my old brain, sorry. Ooops. Okay, now, it fits fine.

    Many Thanks.

+ 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. Conditional Formatting Add 8 hours
    By devildogdad76 in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 07-22-2019, 11:33 PM
  2. Conditional Formatting using hours/time
    By dwtaxguy in forum Excel General
    Replies: 11
    Last Post: 06-26-2017, 02:01 PM
  3. Replies: 8
    Last Post: 05-12-2017, 11:04 AM
  4. [SOLVED] Formulas to tally total hours for each staff from schedule
    By nicki_rae22 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-30-2015, 02:13 PM
  5. [SOLVED] Conditional formatting for hours calculations
    By RANGO in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 05-25-2013, 07:13 AM
  6. Excel formulas for total hours worked
    By jhill in forum Excel General
    Replies: 0
    Last Post: 05-15-2008, 11:33 AM
  7. [SOLVED] Conditional formatting on overtime hours
    By Jennifer in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-23-2006, 04:40 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