+ Reply to Thread
Results 1 to 11 of 11

Changing cell colour according to data in another cell

  1. #1
    Registered User
    Join Date
    04-11-2012
    Location
    Leeds, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Angry Changing cell colour according to data in another cell

    Hi,

    I sincerely apologise if I am duplicating anything on this forum, but I've searched for hours and haven't found anything that works on my Excel sheet yet.

    I'm a relatively new user to Excel (and ready to throw my laptop through the window with frustration) - so any help is so gratefully received! I know it will be the simplest of simple for some people on here.

    Basically, I'm making a document for assessment purposes of students I have. There are different targets they need to achieve in one column, then directly next to that on the right is another column with the value 1 or 0, depending if they've met the criteria (1 for yes, 0 for no).

    I've got the cell with the value to change colour (yellow if the value is 0), but I don't know how to get the cell with the actual target to change colour too.

    Example:

    If a target is met (target is typed into cell B5), I want B5 AND C5 cells to change to grey.
    If this target is not met, I want B5 AND C5 cells to change to yellow.
    If there is no value entered into C5, I want B5 AND C5 to stay white.

    I know it's something to do with the conditional formatting, but I can't figure exactly what to type. It's driving me crazy!

    Any help will be met with a massive THANK YOU!

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Changing cell colour according to data in another cell

    If CF, select new rule, select "use formula to determine which cell to format" in the window that opens up, point to the cell that will determine the color, and give it the condition that will determine the color. something like =a1="ok"

    Pick your color, and you should be done

    let me know how this works for you, or if you have any other questions
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Changing cell colour according to data in another cell

    Hi,

    You are quite correct.
    You need to use conditional formatting in B5 and C5 using the 'Use a formula to determine which cells to format'.

    So in B5 add two rules
    =AND($B$5=0,$B$5<>"") ' formatted as yellow
    =$B$5=1 'formatted as grey

    Copy the formats from B5 to C5
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    04-11-2012
    Location
    Leeds, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Red face Re: Changing cell colour according to data in another cell

    THANK YOU!!!!!!!!!! You have saved me hours and hours and hours

    It works perfectly!

    Just one last question - how do I apply this to more cells? Surely there's an easier way doing it without having to type in to every cell (have about 200 cells to do this with!). Can't find a way to 'copy&paste) it in.

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Changing cell colour according to data in another cell

    Hi,

    Just copy and use Paste special formats. You may need to pay attention to the absolute/relative definition of the cell addresses, but if they're all in the same position, one relative to the other, then you should be OK.

  6. #6
    Registered User
    Join Date
    04-11-2012
    Location
    Leeds, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Changing cell colour according to data in another cell

    I don't understand what it's doing. I've done B5 and C5 with the formula. When I copy these cells, then highlight the cells I want it to copy to, click paste special -> formulas.... it only pastes the stuff (the words, as opposed to the formula) typed into the cell, even when I've definitely made sure I've not clicked 'All'. I don't understand?!?

  7. #7
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Changing cell colour according to data in another cell

    Hi,

    You are misreading what I wrote. I said paste special formats not formulas.

  8. #8
    Registered User
    Join Date
    04-11-2012
    Location
    Leeds, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Changing cell colour according to data in another cell

    I meant formats, sorry. Tried it with formats. Similar applies.

    I copy&paste -> special formats. Result is it copies only one of the two formulas I put it - e.g. it changes grey when I type 1, but not yellow when I type 0.

  9. #9
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Changing cell colour according to data in another cell

    And after you have pasted it, what do the conditional formats say? Are they both the same as the CFs in the cell that you've copied. If they both refer to the original cell and you're copying it down a column to different rows you will need to remove the absolute $ on the row number in the CF. Which is why I said you need to pay particular attention to the absolute/relative definers.

  10. #10
    Registered User
    Join Date
    04-11-2012
    Location
    Leeds, UK
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Changing cell colour according to data in another cell

    One of the CFs is fine - the cell references are of the new cell (perfect, not the one I pasted it from). The issue is that there's only one of the formulas, not the second. Just doing it one by one now.

    Thanks for your help

  11. #11
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Changing cell colour according to data in another cell

    If you want to apply that CF to a range of cells, highlight all the cells 1st, and then enter the CF formula. alternatively, in the CF window, on the rightm select "applies to" and indicate the range you need

+ 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