+ Reply to Thread
Results 1 to 8 of 8

color code cells based on comparing prices in one cell to prices in a previous cell

  1. #1
    Registered User
    Join Date
    01-27-2014
    Location
    Loveland, OH
    MS-Off Ver
    Excel 2010
    Posts
    4

    color code cells based on comparing prices in one cell to prices in a previous cell

    I have compiled price data for say 50 stocks over time. I want to compare the price today with the price of the same stock say 5 days previously. If the price is greater, I want to color it green, if lower red, and if no change yellow. I have tried conditional formatting but could not get it to work. Recommendation please.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: color code cells based on comparing prices in one cell to prices in a previous cell

    I recommend VBA (I always recommend VBA).

    Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    01-27-2014
    Location
    Loveland, OH
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: color code cells based on comparing prices in one cell to prices in a previous cell

    thanks for offering to help. I hope the attachment provides all the info you need.
    Attached Files Attached Files

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: color code cells based on comparing prices in one cell to prices in a previous cell

    Hi FWW,

    Try this:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Open your Workbook

    Save your Workbook or Another Workbook designated for Macros as Macro_Enabled

    Press ALT + F11 to open the Visual Basic Editor.

    Select “Module” from the Insert menu

    Type "Option Explicit" then paste the code under it

    With the cursor between Sub and End Sub press F5 (F8 to Single Step)

    OR

    Press ALT + Q to close the code window.

    Press ALT + F8 then double click on the macro name

  5. #5
    Registered User
    Join Date
    01-27-2014
    Location
    Loveland, OH
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: color code cells based on comparing prices in one cell to prices in a previous cell

    Many, many thanks for the code. I will try it tomorrow. It all looks very complicated.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: color code cells based on comparing prices in one cell to prices in a previous cell

    After a couple of month's it will all become natural

  7. #7
    Registered User
    Join Date
    01-27-2014
    Location
    Loveland, OH
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: color code cells based on comparing prices in one cell to prices in a previous cell

    xladept

    I think I did everything in your guidance but after clicking OK, I received following error note

    Compile error:
    Expected line number or label or statement or end of statement

  8. #8
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: color code cells based on comparing prices in one cell to prices in a previous cell

    Did you copy the whole code including the End Sub??

    I just tried it again and had no problem???

+ 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. Excel Formula to compare prices and display them in different color cells
    By andy11_11 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-28-2013, 11:34 AM
  2. [SOLVED] Extracting latest prices from a price book with past and present prices
    By benoj2005 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-10-2012, 04:08 AM
  3. comparing two prices with IF
    By SRussell in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-03-2008, 05:00 PM
  4. Use a multiplier to change List Prices to Net prices
    By Dangada in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 09-06-2005, 12:05 PM
  5. Cyclic prices into trend prices
    By atult in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-27-2005, 01:19 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