+ Reply to Thread
Results 1 to 8 of 8

Conditional Formatting Help

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Conditional Formatting Help

    I have a list of data that I am trying to format. The length changes depending on what I'm doing. If in one of the rows, a certain 2 cells are empty, then I want to highlight a range of cells in that row. If either of these cells has data in it (a date), then I would like to highlight it a different color. Since the number of rows changes, I don't want this to start highlighting rows after my data ends. Any tips on how to do this? I assume I use a formula through conditional formatting but this is my first attempt at something like this and I'm a little lost.

  2. #2
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional Formatting Help

    Assuming date in B starting at B2, Other cell is column D and that when you have data, column A is always filled in. If you want E:H conditionally formatted, select E:H
    Conditional Formatting>New Rule> Use Formula

    =AND($A1<>"", $B1="", $D1="") format as desired
    =AND($A1<>"", ISNUMBER($B1), $D1="") format differently
    Does that work for you?
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Conditional Formatting Help

    Maybe something like this (untested)

    Assume the "certain 2 cells" are A1 and B1
    Assume also that "cells that have data" are C1 to E1

    Conditional Formatting

    For both cells empty
    Select C1
    New Rule
    Use a formula to determine...
    with the formula
    =(AND(COUNTA($C1:$E1) < > 0,COUNTA($A1:$B1)=0))
    and format as required.

    Use Format painter to copy down the column

    For one or more cells not empty
    Repeat with this new formula
    =(AND(COUNTA($C1:$E1) < > 0,COUNTA($A1:$B1) < > 0))
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  4. #4
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Conditional Formatting Help

    Quote Originally Posted by ChemistB View Post
    Assuming date in B starting at B2, Other cell is column D and that when you have data, column A is always filled in. If you want E:H conditionally formatted, select E:H
    Conditional Formatting>New Rule> Use Formula

    =AND($A1<>"", $B1="", $D1="") format as desired
    =AND($A1<>"", ISNUMBER($B1), $D1="") format differently
    Does that work for you?
    I'm trying this one first, haven't looked at the second yet. I did get that to work but I have 2 questions.

    First, doing it this way I think I end up having 4 formulas. Using your columns, one for if B is filled and D is not, one for if D is filled and B is not, one for if both are filled, and one for if neither are filled. Couldn't you have one condition for if they were both empty (say format red), and have another condition as a 'if the first condition isn't true', format green.

    Second, I can get this to work just fine for one row. What happens if I want to reproduce this for 10 rows or 30 rows?
    Last edited by archie8; 11-08-2012 at 12:23 PM.

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional Formatting Help

    I don't think you will need additional formulas. Upload a spreadsheet with an example of the different possibilities and what you would expect to see (Go Advanced> Manage Attachments)

    If you select the entire range that you wish to conditionally format (in my example it was all of E,D,F,G and H) and then set up the formulas as you would for the first cell in your range (i.e. E1), which is what I did, then Excel will configure each cell appropriately. No need to copy or modify anything.

  6. #6
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Conditional Formatting Help

    I've attached a sample.
    Last edited by archie8; 11-08-2012 at 02:27 PM.

  7. #7
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Conditional Formatting Help

    Okay, since you already have the conditions in place, we'll work from there
    Conditional Formatting>Manage Rules
    Change the "Applies to" field to cover your full range (i.e. =$C$2:$F$500) for both conditions

    You were right about the second formula not being enough (the green one). Select it and edit
    =AND($A2<>"",OR( AND(ISNUMBER($C2), $D2=""), AND($C2="", ISNUMBER($D2))))
    That will turn green if either C2 or D2 (but not both) are empty.
    See attachment
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Conditional Formatting Help

    That works great. Thanks for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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