+ Reply to Thread
Results 1 to 7 of 7

Formula to change colour AND text in cell depending on value in adjacent cell

  1. #1
    Registered User
    Join Date
    04-01-2017
    Location
    London, England
    MS-Off Ver
    Microsoft Office 2011
    Posts
    3

    Formula to change colour AND text in cell depending on value in adjacent cell

    Hi there,

    I'm creating a spreadsheet for a company that owns nearly 40 vehicles. This spreadsheet is for them to keep track of their vehicle's tyre treads.
    I would like for when I enter in B10 a value between 0-2 the adjacent cell (C10) would turn red and the text to change to "URG".
    I know how to change the colour in conditional formatting but am struggling to find a way to also make the text change.

    I'd also like to apply the following rules:
    - When I enter in B10 a value between 2-4, the adjacent cell (C10) would turn orange and the text to change to "1 MTH".
    - When I enter in B10 a value between 4-6, the adjacent cell (C10) would turn green and the text to change to "OK".
    - When I enter in B10 a value greater than 6 the adjacent cell (C10) would turn white and the text to change to "NEW".

    Thanks so much for your help!

    H

  2. #2
    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,410

    Re: Formula to change colour AND text in cell depending on value in adjacent cell

    Welcome to the forum!

    You will do the colour using CF and the text using a formula in C10. However, what do you want it to show if:

    B10 = 4
    B10 = 6

    ???
    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.

  3. #3
    Registered User
    Join Date
    04-01-2017
    Location
    London, England
    MS-Off Ver
    Microsoft Office 2011
    Posts
    3

    Re: Formula to change colour AND text in cell depending on value in adjacent cell

    Thanks Ali, good question...
    Let's say:
    If B10 = 2 it's orange
    If B10 = 4 it's green
    If B10 = 6 it's white

  4. #4
    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,410

    Re: Formula to change colour AND text in cell depending on value in adjacent cell

    So, try this:

    =LOOKUP(B10,{0,2,4,6},{"URG","1 MTH","OK","NEW"})

    I was sitting at KwikFit at this time last week waiting for their computer systems to come back online ... It was a three-hour wait just to be told they didn't have my tyre in stock!!!

  5. #5
    Registered User
    Join Date
    04-01-2017
    Location
    London, England
    MS-Off Ver
    Microsoft Office 2011
    Posts
    3

    Re: Formula to change colour AND text in cell depending on value in adjacent cell

    Ali, this is awesome, thanks so much!

    I'm now struggling a little bit with the colours... The formula I used for the "URG" rule was =$B$10<2, which obviously worked brilliantly in conditional formatting to change the colour to red. However, I've tried creating the same rules for the orange, green and white colours but have obviously stumbled across the need to put in a greater than symbol. For example, if the tyre tread is greater than 2 but less than 4, I need it to turn orange but not white which is currently overriding all other formulas.

    Also, is there a way I can copy and paste all formulas applying to 2 cells and apply the same rules? I could do this manually, but it would take an awfully long time seeing as I have 40 vehicles and 4 tyres on each vehicle!

    Thanks again!

  6. #6
    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,410

    Re: Formula to change colour AND text in cell depending on value in adjacent cell

    Now you can make the CF rule based on the text that appears in C10, can't you.

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,147

    Re: Formula to change colour AND text in cell depending on value in adjacent cell

    Set the "Applies to:" in CF to the required range(s)

+ 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. [SOLVED] Change adjacent cell depending on text
    By Tubby McChubbles in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-28-2013, 08:25 AM
  2. [SOLVED] Macro to change text colour of adjacent cell to the same text colour as target cell
    By kayoke in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-28-2012, 04:18 AM
  3. Replies: 2
    Last Post: 06-07-2011, 07:00 AM
  4. Change cell text depending on colour of a cell
    By wonderdunder in forum Excel General
    Replies: 3
    Last Post: 09-22-2010, 11:31 AM
  5. Excel VBA Change text colour depending on another cell's content
    By jell in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2010, 11:05 AM
  6. text colour change depending on outcome of formula
    By irons182 in forum Excel General
    Replies: 17
    Last Post: 07-07-2009, 10:33 AM
  7. 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
  8. Replies: 2
    Last Post: 01-06-2006, 03:50 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