+ Reply to Thread
Results 1 to 5 of 5

Cell formatting by formula or macro?

  1. #1
    Registered User
    Join Date
    07-04-2008
    Location
    Leicester
    Posts
    12

    Cell formatting by formula or macro?

    Hi,

    I was hoping someone can help me please.

    A1=text A2 will either be "yes" or "No"

    What I want to do is format A1 by either a fill colour or text colour. Any type of format I guess. If A2 is "Yes" then A1 is green and If A2 is "No" then A1 is red.

    Many thanks in advance and probably sorry for being a bit thick.

    Mark
    Last edited by Artisan; 01-06-2009 at 07:12 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    523
    You can achieve this using Conditional formatting:

    Select cell A1|Click Format| Conditional formatting..
    Change first field from Cell value is to Formula is
    Enter this into second field: =a2="Yes"
    Click Format button
    Click the Patterns tab and choose your colour for when A2 is Yes
    Repeat the process by clicking the Add>> button to add a second conditional format for when A2 is "No"- just change the desired pattern colour

    Note that Excel may 'mess up' the =a2="Yes" formula you enter the first time by automatically inserting extra apostrophes. Delete these manually by going into the conditional format dialog.

  3. #3
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Something like this
    Attached Images Attached Images
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  4. #4
    Registered User
    Join Date
    07-04-2008
    Location
    Leicester
    Posts
    12
    Thank you.

  5. #5
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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