+ Reply to Thread
Results 1 to 24 of 24

Conditional formatting that extends over a range of data

  1. #1
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Conditional formatting that extends over a range of data

    Hi

    I want the outcome to be true when two cells have certain conditions met....but then this needs to repeat down the columns.

    I will try to make it clearer:

    The formula is contained in D1. So D1 shades if the below condition is met:

    If A1 = x and B1 = y then D1 shads.

    So I have:

    =AND(A1="x",B1="y")

    However I want D1 to shade:
    IF A2 = "x" , B2="y"
    And A3 = "x" , B3 = "y"
    AND A4 and B4 etc etc...

    Many thanks

  2. #2
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: Conditional formatting that extends over a range of data

    You could use the CONCATENATE function in your CF and check if A2A3A4 equals "xxx" etc.
    When I say semicolon, u say comma!

  3. #3
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    I am I am not following. If your formula fixes the below please be a bit more detailed

    IF

    A1 = Blank and B1 = Blank
    A2 = Blank and B2 = Blank
    A3 = Blank and B3 = Blank
    A4 = Blank and B4 = Blank
    etc...
    Then D1 = No shading

    However if for example:
    A1 = Blank and B1 = Blank
    A2 = Blank and B2 = Blank
    A3 = "x" and B3 = "y"
    A4 = Blank and B4 = Blank

    Then D1 = shading

  4. #4
    Forum Contributor
    Join Date
    08-02-2013
    Location
    Wageningen, The Netherlands
    MS-Off Ver
    365
    Posts
    495

    Re: Conditional formatting that extends over a range of data

    Ok we're not on the same page on what combination of values should result in the shading of D1.

    Is this it?
    Shade D1 if every pair of cells (like A1 and B1, or A2 and B2) is blank&blank OR x&y
    Do NOT shade D1 if one or several of the pairs are not blank&blank or x&y

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    Use a formula for the CF:
    =COUNTIFS($A$1:$A$10,"X",$B$1:$B$10,"Y")>0
    Remember what the dormouse said
    Feed your head

  6. #6
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Hi sorry

    If A1 and B1 or any pair of cells in the column of A and B have the value x and y then shade d1...if all the values in column A are Blank and all the values in Column B are blank then don't shade D1. But it is important that there is the X&Y relationship to make D1 shade. We can't use a concatenation because x is actually a number.

    So what i'm saying is that if A1 = Nil and B1 has a value of 0 to n then shade D1.

    This actually works:
    =AND(A1="NIL",B1="12345")

    the D1 shades

    BUT I need it to work for 183 rows down the column...remember. X and Y are variables.

    So x is actually the word "Nil" and Y could be any integer

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    =sumproduct((isnumber($a$1:$a$10))*(isnumber($b$1:$b$10)))>0

  8. #8
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Hi thanks for all the suggestions.

    I still don't think you are understanding what i need.

    I have attached an example.
    Attached Files Attached Files

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    Try:
    =COUNTIFS($B$2:$B$10,"Nil",$C$2:$C$10,">0")

  10. #10
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    This works perfectly. If I wanted to add in an additional outcomes of "<Enter amount>" how would i go about doing this?

    =COUNTIFS($B$2:$B$10,"Nil",$B$2:$B$10,"<Enter amount>",$C$2:$C$10,">0").

    This does not work.

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    Unfortunately you can't use array constants in CF formulas so a simple solution would be:
    =COUNTIFS($B$2:$B$10,"Nil",$C$2:$C$10,">0")+COUNTIFS($B$2:$B$10,"<Enter amount>",$C$2:$C$10,">0")

  12. #12
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    That worked! Thanks

  13. #13
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  14. #14
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Apologies.

    I just noticed that target cell remains shaded when other values exist in B2....referring back to the example

    If "NIL" OR "<Enter amount>" is selected it turns red. However if the value of "> $1.0m potential P&L impact" or "< $1.0m potential P&L impact" is selected the cell remains red.

  15. #15
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    Whoops - change the last section of the formula to this:
    COUNTIFS($B$2:$B$10,"=<Enter amount>",$C$2:$C$10,">0")

  16. #16
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Unfortunately thats no doing it. Now target cell shades only when B = Nil.

  17. #17
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Unfortunately thats not working. Now target cell only shades when B = "Nil"

  18. #18
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    It works for me.

  19. #19
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    =+COUNTIFS($B$2:$B$10,"Nil",$C$2:$C$10,">0")+COUNTIFS($B$2:$B$10,"*=*<Enter amount>",$C$2:$C$10,">0")

    This is what I have?

  20. #20
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Have attached my test.
    Attached Files Attached Files

  21. #21
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    Remove the asterisks.

  22. #22
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Ha ha....I did think the asterisks looked odd but honestly didn't think to test. Thanks. Resolved

  23. #23
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Conditional formatting that extends over a range of data

    I'm not really sure where you got them from.

  24. #24
    Registered User
    Join Date
    08-02-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    38

    Re: Conditional formatting that extends over a range of data

    Oh that's really interesting. I'm on my iPhone and I reread the thread and I notice that you inserted the = sign and made it blue.... However on my PC the equals sign does not display as a bold blue but rather an = sign with asterisks around it! "SOLVED"

+ 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 via VBA: Change formatting in range based on value of each cell
    By ralphjmedia in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-12-2013, 10:37 AM
  2. Conditional formatting formula -Data range?
    By elfiky in forum Excel General
    Replies: 2
    Last Post: 09-27-2011, 02:44 AM
  3. Replies: 1
    Last Post: 02-10-2011, 11:13 AM
  4. Macro that extends cells to the last row
    By Nett in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-17-2010, 03:33 AM
  5. Conditional formatting for data range?
    By Stickshift in forum Excel General
    Replies: 1
    Last Post: 08-24-2008, 06:26 PM

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