+ Reply to Thread
Results 1 to 3 of 3

Excel macro comparing number and setting colour

  1. #1
    Registered User
    Join Date
    02-07-2005
    Posts
    1

    Excel macro comparing number and setting colour

    Hi folks, not sure if anyone can help me but my boss has just asked for the following in the misguided belief that I know the first thing about excel.

    I need a macro that will compare two sets of numbers and if they vary by more than x% set the attributes of one of the numbers to make it red

    Much appreciation in advance.

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Suppose the first set of numbers is in column A starting from A1, and the second set is in column B starting from B1. Do the following
    1. Select cell B1
    2. Go to Format > Conditional Formatting
    3. Select "Formula Is" in the drop down box which shows "cell value is".
    4. In the adjoining box, enter the following formula: =B1/A1-1>0.2
    5. Select the required format by clicking on the format button, in the font tab select red color for the font.
    6. Copy the format for all the cells in column B


    - Mangesh

  3. #3
    Registered User
    Join Date
    01-09-2005
    Location
    London, UK
    Posts
    47
    Or, you could just try putting it all into Conditional Formatting (Format>Conditional Formatting from the Toolbar). It would be a lot simpler than trying to use a Macro to do it.

+ 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