+ Reply to Thread
Results 1 to 13 of 13

Conditional Formatting based on Text and Value

  1. #1
    Registered User
    Join Date
    03-05-2011
    Location
    Havant, England
    MS-Off Ver
    Office 2007
    Posts
    48

    Conditional Formatting based on Text and Value

    Hi,

    I am looking to conditionally format a number of cells, B1:B3. I need these to go either Red, Amber of Green dependent on the what is entered into these cells but based on a target cell, B4. This though is dependent on what text is in A1.

    As an example;

    If A1 = Ford then the target in B4 would be 100. This target though is subject to change based on what is in A1.

    If A1 = Ford and B1 was within 5% of B4 (either greater or less) then this would turn the cell green.
    If A1 = Ford and B1 was greater than 5% or more of B4 then this would turn the cell red.
    If A1 = Ford and B1 was less than 5% or more of B4 then this would turn the cell amber.

    Does this help or am I not explaining this correctly?

    Any help appreciated, thanks.

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Conditional Formatting based on Text and Value

    Is the formatting conditional on A1 = Ford? For example does A1 have to = Ford AND B1 be within +/- 5% or B4 for B1 to turn green or does only the latter condition have to be true for the colour change?

    BSB

  3. #3
    Registered User
    Join Date
    03-05-2011
    Location
    Havant, England
    MS-Off Ver
    Office 2007
    Posts
    48

    Re: Conditional Formatting based on Text and Value

    The formatting is conditional to B4, the caveat to that though is that B4 can change based on what is A1.

    I may have to write tens of conditions which isn't an issue its just getting it to recognise that A1 has changed and thus the conditions for B4 have too.

    I hope this makes sense.

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Conditional Formatting based on Text and Value

    Quote Originally Posted by Barrera006 View Post
    If A1 = Ford and B1 was within 5% of B4 (either greater or less) then this would turn the cell green.
    Assuming B4 = 100, if B1 is anywhere between and inclusive of 95 and 105 then these cells should be green?

    Quote Originally Posted by Barrera006 View Post
    If A1 = Ford and B1 was greater than 5% or more of B4 then this would turn the cell red.
    Assuming B4 = 100, if B1 is greater than 105 then the cells should be red?

    Quote Originally Posted by Barrera006 View Post
    If A1 = Ford and B1 was less than 5% or more of B4 then this would turn the cell amber.
    This one seems to contradict. Do you mean if this one is less than 95% of B4 (assuming B4 = 100 then B1 is less than 95)?

    BSB

  5. #5
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: Conditional Formatting based on Text and Value

    If A1 = Ford and B1 was within 5% of B4 (either greater or less) then this would turn the cell green.
    If A1 = Ford and B1 was greater than 5% or more of B4 then this would turn the cell red.
    If A1 = Ford and B1 was less than 5% or more of B4 then this would turn the cell amber.

    These two conditions are the same aren't they?

    If A1="Ford" and B1 > than 5% or more of B4 then red.
    This leaves
    If A1="Ford" and B1 < than 5% or more of B4 which is the same
    as
    If A1="Ford" and B1 is within 5% of B4
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  6. #6
    Registered User
    Join Date
    03-05-2011
    Location
    Havant, England
    MS-Off Ver
    Office 2007
    Posts
    48

    Re: Conditional Formatting based on Text and Value

    Apologies, yes.

  7. #7
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Conditional Formatting based on Text and Value

    OK, the attached is done with three CFs, one for each colour. It's based solely on the value in B4.

    Hope this helps.

    BSB

  8. #8
    Registered User
    Join Date
    03-05-2011
    Location
    Havant, England
    MS-Off Ver
    Office 2007
    Posts
    48

    Re: Conditional Formatting based on Text and Value

    That's fantastic and a lot of help.

    The question is what happens if A1 changes to lets say Vauxhall and B4 is then 120 and the conditions change? i.e. If B1 = 120 or greater then the cell is green and if B1 = less than 120 then the cell is red.

    Thanks for your help but its the change in A1 that's the big struggle.

    Appreciate any help.

  9. #9
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Conditional Formatting based on Text and Value

    If the formatting should be green if the value for Ford and Vauxhall (or any other car manufacturer) is +/- 5% of the value in B4 (and the same for the other colours) then this is not a problem.
    It's based on the value in B1 relative to a percentage of the value in B4 rather than the actual value in B4.

    BSB

  10. #10
    Registered User
    Join Date
    03-05-2011
    Location
    Havant, England
    MS-Off Ver
    Office 2007
    Posts
    48

    Re: Conditional Formatting based on Text and Value

    The condition is based on what is in B4 but this value may change due to the value of A1. Also the conditions will change based on the value of A1.

    Thanks for your help.

  11. #11
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Conditional Formatting based on Text and Value

    So Vauxhall may have different percentages of B4 that fire the conditional formatting than Ford? Any other manufacturers may again have different percentages still?

    How many different sets of conditions are you looking at here?

    BSB

  12. #12
    Registered User
    Join Date
    03-05-2011
    Location
    Havant, England
    MS-Off Ver
    Office 2007
    Posts
    48

    Re: Conditional Formatting based on Text and Value

    Hi,

    There are 10 different possibilities for A1, some may have 2 and others 3 conditions so possibly up to 30 conditions.

    Its trying to figure the formula etc then its a "data entry" task to do all of the formulas.

    Really appreciate your help on this.

  13. #13
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Conditional Formatting based on Text and Value

    I think if we could see what the file you have so far and have details of the 10 possibilities for A1 and their respective percentages for CF then that may help provide you with a solution.
    There's a chance that there's a simpler solution to this than 30 sets of conditional formatting (or 3 lots with very long and complicated IF/AND/OR statements) but hard to say without a better understanding of the task in hand I'm afraid.

    BSB

+ 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. VBA Conditional Formatting based on cell value and Text
    By uroy67640 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2015, 01:38 AM
  2. [SOLVED] Conditional Formatting Based On Text Value
    By Tenaciousjeebs in forum Excel General
    Replies: 2
    Last Post: 05-08-2014, 03:15 PM
  3. [SOLVED] Conditional Formatting based on Text Color
    By JBailey-LMC in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-25-2013, 03:22 PM
  4. Replies: 1
    Last Post: 03-21-2012, 03:27 PM
  5. conditional formatting row based on text
    By lpratt in forum Excel General
    Replies: 5
    Last Post: 02-01-2011, 08:49 PM
  6. Conditional Formatting based on Text
    By avidcat in forum Excel General
    Replies: 3
    Last Post: 12-31-2010, 07:11 AM
  7. Conditional formatting based on text
    By Gilles Desjardins in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 02-18-2005, 10:06 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