+ Reply to Thread
Results 1 to 6 of 6

Relative References in Conditional Formatting (bars & scales)

  1. #1
    Registered User
    Join Date
    09-12-2010
    Location
    Kuwait
    MS-Off Ver
    Excel 2003
    Posts
    4

    Question Relative References in Conditional Formatting (bars & scales)

    I am an Equipment Operator with the Navy Seabees, and the Yard Boss at Camp Moreell in Kuwait. We have CESE (Civil Engineering Support Equipment) going into IEM (Inactive Equipment Management). What this means; our CESE has to be cycled (checked for preventative maintenence issues, started up, ran...) once a week if it hasn't been used within a seven day period, but CESE going into IEM only needs to be cycled once per month.

    Column E in my report reflects that as a two part eight day graph, with the formula =TODAY()-8 for the shortest end of the bar graph and the red of the graded color scale, and =TODAY() for the long end of the bar and the green of the color scale. If a piece is cycled today I enter today's date and the bar shows full and the scale is green. As that date approaches 8 days past, the bar moves to the left and the scale changes yellow to red.

    I need that graph (column E) to change to a thirty day scale when I change the LOCATION (column D) to IEM, back to an eight day if I change it to DISPATCH, and to clear out completely if I change to any other location.

    I've tried a few different things, but can't seem to get any of them to work. One thing I tried that I thought would work--but didn't--is to make column H (which I planned to hide) equal eight if the corresponding row in column D equals DISPATCH (using an IF formula), and to equal thirty if it's IEM. Then I wrote my graph formula a few different ways to the general effect of =TODAY()-H:H but no way that I wrote it worked. I couldn't figure out a way to just make DISPATCH equal a hidden value of eight, and IEM to equal thirty, but since the formula I did for the method I tried didn't work anyway, I wouldn't have gotten that to work either. I was able to get column H to reflect eight or thirty in accordance with column D, but I can't get the graph to cooperate.

    I also tried entering the formula =IF(D:D="IEM",TODAY()-31,TODAY()-8) into the Conditional Formatting formula field for the color scale and data bar, but I get the error "You cannot use relative references in Conditional Formatting criteria for color scales, data bars, and icon sets."

    What's my work around?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: Relative References in Conditional Formatting (bars & scales)

    Hi Tim,

    Here is one option, given you can't use relative references for color scales and data bars.

    In cell F2 copied down (I inserted a column):
    =IF(D2="IEM",(E2-(TODAY()-31))/31,IF(D2="DISPATCH",(E2-(TODAY()-8))/8,""))

    Apply the conditional formatting to F2 down, setting your min. and max. values to 0 and 1 in your formatting rules. For the Data Bar rule select Show Bar Only.

    Please see attached.
    Attached Files Attached Files
    Last edited by pb71; 09-13-2010 at 04:11 PM.

  3. #3
    Registered User
    Join Date
    09-12-2010
    Location
    Kuwait
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Relative References in Conditional Formatting (bars & scales)

    That's pretty good, pb71, not exactly the effect I was going for, but since I seem to have encountered a limitation in Excel, this might just be my only option. It's exactly what I'm looking for, except I liked having the date on top rather than in a seperate column. I had a feeling some tricky math would lead to my fix.

    You get an add for that. Thanks!

  4. #4
    Registered User
    Join Date
    09-12-2010
    Location
    Kuwait
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Relative References in Conditional Formatting (bars & scales)

    what would I add to that formula to get "NA" in the graph column (F) if there is no entry in the date column (E)?

  5. #5
    Forum Contributor
    Join Date
    05-16-2010
    Location
    UK
    MS-Off Ver
    2003 and 2007
    Posts
    252

    Re: Relative References in Conditional Formatting (bars & scales)

    To display NA in column F if there is no date entered in column E:

    In F2 copied down:

    =IF(ISNUMBER(E2),IF(D2="IEM",(E2-(TODAY()-31))/31,IF(D2="DISPATCH",(E2-(TODAY()-8))/8,"")),"NA")

    allows text entry e.g. "NA" in column E for "DISPATCH" and "IEM" without an error displaying in column F, so you could use:

    =IF(ISNUMBER(E2),IF(D2="IEM",(E2-(TODAY()-31))/31,IF(D2="DISPATCH",(E2-(TODAY()-8))/8,"")),"")

    and type "NA" in column E
    Last edited by pb71; 09-14-2010 at 02:58 PM.

  6. #6
    Registered User
    Join Date
    09-12-2010
    Location
    Kuwait
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: Relative References in Conditional Formatting (bars & scales)

    Thanks pb71, you've been a great help. I've used your formula and have gotten the spreadsheet working up to my standards. I now only have one remaining issue. First let me clearify that I cannot use macros on the military LAN and computers because they're blocked, and there's no acceptions for this (I've asked). So a macro solution is out.

    My problem is, if I hide the formula and protect the sheet, when I add a new row the formula is not copied into the new row. My users need to be able to add new rows when new CESE comes in. If I add a new row, and drag the formula down from the row above, it only copies the format, not the formula. Is there a way to get this hidden formula ot copy into a new row?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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