+ Reply to Thread
Results 1 to 17 of 17

Cell changing colour depending upon value

  1. #1
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Cell changing colour depending upon value

    Dear all,

    I hope you can help.
    I have a spreadsheet where id like the cell above the drop down list change colour depending upon what value you choose.

    So if you select yes, then the cell with 1 in it turns green and if you select no it turns red.
    Also there are 6 cells, is it possible that in cell I10 it gives the total of the previous 6 cells in terms of if you select yes for 3 in cell I10 it states '3/6 completed'

    Any help gratefully appreciated

    test.xlsx

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Cell changing colour depending upon value

    The first part is just basic Conditional Formatting.

    For the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Re: Cell changing colour depending upon value

    thank you so much.
    I get the bit about conditional formatting but how do I get the cell c3 to change colour based upon the values in cell c10 please?
    Last edited by AliGW; 03-17-2024 at 03:37 PM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Cell changing colour depending upon value

    Using conditional formatting, select the cells C3:H3 and apply the following rules (all the way below). By the way, merging cells is a very undesirable practice.

    Values as displayed
    C
    D
    E
    F
    G
    H
    I
    3
    1
    2
    3
    4
    5
    6
    4
    5
    6
    7
    8
    9
    10
    Yes
    No
    Yes
    No
    Yes
    3/6
    Sheet1


    Underlying formulas
    C
    D
    E
    F
    G
    H
    I
    3
    4
    5
    6
    7
    8
    9
    10
    =COUNTIF(C10:H10,"Yes")&"/"&COUNTA(C3:H9)


    Conditional Formatting Rules
    Formula
    Applies To Formula Format Stop If True
    $C$3:$H$9 =C10="Yes" False
    $C$3:$H$9 =C10="No" False
    Sheet1
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Re: Cell changing colour depending upon value

    That's a massive help, thank you so much!
    One last request please.

    In the attached spreadsheet, if I want to exclude cell F3 so it doesn't reflect in the total in cell J4 how would I do that please?
    Many thanks

    back2thefuture=test (1).xlsx

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Cell changing colour depending upon value

    Do you really mean how to exclude counting any cells that are blank in row 4? You are using COUNTA in row 3, which counts non-empty cells. But all the cells have values. You could use COUNTA on row 4 instead.

    Values as displayed
    C
    D
    E
    F
    G
    H
    I
    J
    3
    1
    2
    3
    4
    5
    6
    7
    4
    Yes
    Yes
    No
    Yes
    Yes
    Yes
    5/6
    Sheet1


    Underlying formulas
    C
    D
    E
    F
    G
    H
    I
    J
    3
    4
    =COUNTIF(C4:I4,"Yes")&"/"&COUNTA(C4:I4)

  7. #7
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Re: Cell changing colour depending upon value

    Hi again thank you for this.
    Apologies I should have been more clearer. So in the attached spreadsheet in cell F3 there is an 'X' But id like to exclude that from the total in cell J4 please...

    back2thefuture=test (1).xlsx
    Last edited by AliGW; 03-18-2024 at 02:48 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Cell changing colour depending upon value

    The formula I provided will give that answer whenever there is a blank in row 4 instead of "Yes" or "No". Does it matter what is in row 3?

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Cell changing colour depending upon value

    Quote Originally Posted by back2thefuture View Post
    So in the attached spreadsheet in cell F3 there is an 'X' But id like to exclude that from the total in cell J4 please...
    If you want to ignore "Yes" in F4:
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Quang PT

  10. #10
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,921

    Re: Cell changing colour depending upon value

    Are you still using Excel 2019?

    This will ignore the X:

    =COUNTIF(C4:I4,"Yes")&"/"&COUNT(C3:I3)

    COUNT will count only numbers, not text, and the result will be 5/6 - is that what you want?
    Attached Files Attached Files
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  11. #11
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Re: Cell changing colour depending upon value

    Thanks guys for all the help.
    Think we are nearly there. I will try and better explain what im after.
    Cell K4 shows the total. Currently it shows 0/0. It should be 0/6 because id like to ignore cells F4 and H4?
    Any help sincerely appreciated


    back2thefuture=test (1) AliGW.xlsx

  12. #12
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Re: Cell changing colour depending upon value

    Anyone please?

  13. #13
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Re: Cell changing colour depending upon value

    Could anyone help please
    Last edited by AliGW; 03-21-2024 at 04:32 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead. And don't bump threads more than ONCE in every 24 hours. Thanks.

  14. #14
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,921

    Re: Cell changing colour depending upon value

    How should Excel know that F and H are to be ignored based on this???

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    C
    D
    E
    F
    G
    H
    I
    J
    K
    4
    0/0
    Sheet: Sheet1



    What happened to this layout? Wny do you keep changing the requirements???

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    C
    D
    E
    F
    G
    H
    I
    J
    3
    1
    2
    3
    X
    5
    6
    7
    4
    Yes Yes No Yes Yes Yes 5/7
    Sheet: Sheet1

    Utterly confusing, but maybe try this:

    =COUNTIF(C4:I4,"Yes")&"/"&COUNTA(C4:I4)
    Last edited by AliGW; 03-21-2024 at 04:20 AM.

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,921

    Re: Cell changing colour depending upon value

    If this is what you mean:

    AliGW on MS365 Beta Channel (Windows 11) 64 bit

    C
    D
    E
    F
    G
    H
    I
    J
    K
    3
    4
    No Yes Yes No Yes Yes 4/6
    Sheet: Sheet1

    then this:

    =COUNTIF(C4:I4,"Yes")&"/"&COUNTA(C4:I4)

    Otherwise I really don't know what you expect. Excel can't distinguish one empty box from another and it can't count colour formatted cells by formula, either.

    It would be helpful if you'd hang around for a while after bumping a thread to respond to any queries.

  16. #16
    Registered User
    Join Date
    12-14-2011
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    53

    Re: Cell changing colour depending upon value

    Thanks Ali. Should it be this instead:

    =COUNTIF(C4:J4,"Yes")&"/"&COUNTA(C4:J4)
    Last edited by AliGW; 03-21-2024 at 06:23 AM. Reason: Please don't quote unnecessarily - use the Quick Reply button instead.

  17. #17
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,921

    Re: Cell changing colour depending upon value

    Probably, if that's the range you want to look at - but I don't know why you are asking me when YOU keep changing the requirements!

    Does it do what you want?

    If so, glad to have helped.

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

    Also, if you have not already done so, remember that you can reward anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of each of those who offered help.

+ 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. Changing Colour of one cell depending on value of another
    By jaarons in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-12-2012, 10:28 AM
  2. changing row colour depending on multiple cell values
    By Erikp in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-15-2011, 06:57 PM
  3. Help changing colour of cell depending on date entered
    By dazlia in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-07-2011, 10:59 AM
  4. Changing background colour transparency depending on cell value
    By wopoq in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2010, 08:39 PM
  5. changing a cell depending on the fill colour of adjacent cells
    By debbiec in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-21-2009, 06:11 AM
  6. Changing cell colour depending on content??
    By Simon Lloyd in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-15-2006, 07:55 AM
  7. [SOLVED] Changing cell colour depending on another cells value...
    By Web master in forum Excel General
    Replies: 3
    Last Post: 01-10-2006, 08:35 AM
  8. [SOLVED] Changing cell colour depending on another cells value...
    By Web master in forum Excel General
    Replies: 3
    Last Post: 01-10-2006, 08:35 AM

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