You are here:

# Excel/Conditional Formatting

Advertisement

Question
Hi Stuart:

I use Excel 2007 and I would like to have the following done in Excel:

Time In: C10 (00:00)
Time Out: C11 (00:00)
Hours Worked: D11 (0.00)
Holidays: Drivers Hours Breakdown!Holidays G10:G19
Daily Dates:  C9:O9 (00/00)

If a manager approves time from dropdown menu in C17 with "yes", there is no formatting, "no" it turns red

If a cell is equal or between 15:55 or 16:00, there is no formatting

If a cell is less than 15:55 and is greater than 16:00, it turns red

If a cell is equal or between 21:55 or 22:00, there is no formatting

If a cell is less than 21:55 and is greater than 22:00, it turns red

If a cell is less than or more than 6 hours, it turns red, otherwise if it's 6 hours, no formatting

If a date falls on a holiday, total hours worked * 1.5, otherwise total hours worked

Thanks for any help.

Answer
On a new Excel workbook, enter into cells A1:A3

15:00
15:57
16:01

Select A1:A3. Choose from menu: Home, Conditional Formatting, New Rule, Select a Rule Type: Use a formula to determine which cells to format

In the text box labeled "Format values where this formula is true:", enter

=or(a1<timevalue("15:55"),a1>timevalue("16:00"))

The above formula means, "Apply the conditional formatting to the selected cells if the time entered in the cell is either before 15:55 or after 16:00." The formula refers to cell A1 because that's the upper-left cell of the selected range that we're applying this conditional formatting to.

After entering that formula, click Format, Font, Color: [red], OK, OK.

Note that the font in range A1:A3 is now red whenever the time entered is before 15:55 or after 16:01.

Now that you understand how to use conditional formatting, you should be able to work out for yourself all the different ways you want to use it. If you have further questions, you can post here again. Post as many times as you like, but each post should contain ONE specific question, explained very very clearly, using a concrete example.
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Stuart Resnick

##### Expertise

I can answer questions relating to MS Excel formulas, or to programming with vba (Visual Basic for Applications) in the Excel environment. Please follow the following guidelines: your question should focus on one specific issue you want to learn. It's beyond the scope of this free service for me to create entire projects or complex vba solutions for you from scratch. You should be able to do most of the work yourself, and come here when you need help with a specific point you're stuck on. ALWAYS include a simple, concrete example illustrating what you want to learn. Explain this example in detail in the text of your question (what data is in which cells of which sheets, etc). Be very precise about the results you want, using this sample to make the logic clear. Always keep these examples SIMPLE. Never e.g. use 18 worksheets in your example if using 2 or 3 will do. Never use ranges like AI567:BB865 if using a range like A1:B3 will do. Thanks.

##### Experience

As a consultant, I've designed Excel tools since the 90s, working for the Federal Reserve Bank, AT&T, and (currently) Gap Inc.

Education/Credentials
My only "education" comes from 2 decades of doing spreadsheet/programming work, with major SF Bay Area corporations such as AT&T, Federal Reserve Bank, and Gap Inc.

©2017 About.com. All rights reserved.

Browse Answers: