Changing font colors in Excel with IF statements

End user supplied how to documents and discussion.

Changing font colors in Excel with IF statements

Postby polyvox » Thu Apr 11, 2013 12:12 pm

Stock prices In Excel --- I want to change the font color of a cell to black, green or red (respectively) IF it equals, exceeds or does not exceed (respectively) another number in another cell. I want to create a macro that will make this change to cells in an entire column.

To be more precise, I have a column of figures (column E) in Excel that represent a price/share basis (the price a stock was bought at). Another column (column G) represents the current price/share. I want that second column to show figures in black, green or red according to how they compare to the figures in the previous column (cell by cell).

It might be nice to have a macro that does this for a single cell first, to see how it works. Then another macro to accomplish the same thing over the entire column.

Any takers?
User avatar
Posts: 30
Joined: Sat Jan 13, 2007 12:12 am
Location: Los Angeles

Re: Changing font colors in Excel with IF statements

Postby gb2 » Thu Apr 11, 2013 5:28 pm

I think you want to do it with Excel's Conditional Formatting instead of a QuicKeys shortcut. See How to change background color based on cell value in Excel?
User avatar
Site Admin
Posts: 2878
Joined: Mon Feb 06, 2006 6:22 pm

Return to QKM How Tos

Who is online

Users browsing this forum: No registered users and 2 guests