This page is an advertiser-supported excerpt of the book, Learn Excel 2007-2010 from MrExcel - 512 Excel Mysteries Solved. If you like this topic, please consider buying the entire e-book.
Display Up/Down Arrows
Problem: I have a series of closing stock prices. If the price for the day goes up, I want to display an up symbol. If the price goes down, display a down symbol.
Strategy: Use an IF statement in combination with a Webdings or Wingdings font.
Most computers have at least four font faces composed of symbols. To easily browse the symbols, enter =CHAR(ROW()) in cells A1:A256. Change the font for column A to Webdings or one of the three Wingdings fonts. As you browse through the symbols and see one that you would like, click on the symbol. Below is a possible arrow to use. You can see that this is in the Wingdings 3 font. From the row number, you know it is character code 199. From the formula bar, you can see that it is the C with a cedilla mark below.
Figure 397 Character 199 is a possibility.
If you are reading this and you have a Portuguese keyboard, you probably have a key with the cedilla C. However, you will have to fly to France to find an E with a grave accent. You could try to master the art of holding down Alt while typing 0199 on the numeric keypad, or you could use CHAR(199).
Personally, for me, all of those are too much hassle and I won’t use the arrows shown above. Instead, I found the symbols that correspond to letters on my keyboard, so that I can easily type them in the formula.
Figure 398 These six symbols are all typeable on a U.S. keyboard.
The strategy is to write an IF statement that produces a 5 for positive and a 6 for negative. Then, format those cells to use the Webdings font.
Use a formula such as =IF(B2>B3,5,6) to use the Webdings symbols. If you prefer the filled triangles from Wingdings 3, use =IF(B2>B3,"p","q"). Initially, you will get a column of 5 and 6.
Figure 399 The formula produces 5’s and 6’s.
Select column C and change the font to Webdings. Use Left alignment.
Figure 400 Convert the column to Wingdings.
Gotcha: If you ever need to edit the formula in C, it will appear in Webdings font and be unreadable in the cell. Use the Formula bar to see the real formula.
If you want to display the arrows in green and red, change the font color of column C to green. Then use Home, Conditional Formatting, Highlight Cells Rules, Equal to, 5. Open the Format dropdown and choose Custom Format. On the Font tab, choose a bright red.
If you have Excel 2010, you can use the new Up, Flat, Down icon set. See Icon Sets in Part IV of this book.
Alternate Strategy: You can avoid the IF statement and use a custom number format. Use a formula of =SIGN(B2-B3) in column C. This will return a negative one for days that the price went down, positive one for days when the price went up, and a zero for days where the price is unchanged.
Change the custom number format to [green]\r;[red]\s;. Change the font to Wingdings 3.
Figure 401 Forcing Excel to show r for positive and s for negative.
The custom number format is using three zones. The first zone is showing a lower case r in green for any positive number. The second zone is showing a lower case s in red for any negative number. The third zone is indicated by the final semi-colon and is blank, indicating no symbol for zero values. When you convert column C to Wingdings 3, you get the arrows shown.