Excel: Match Web Colors with HEX2DEC

This page is an advertiser-supported excerpt of the book, Power Excel 2010-2013 from MrExcel - 567 Excel Mysteries Solved. If you like this topic, please consider buying the entire e-book.

Problem: I need my Excel document to match the colors on our website. I can tell from the HTML that the Web background is #FF9007. How can I match this in Excel?

Strategy: The colors specified in HTML are hexadecimal numbers. This numbering system has 16 digits, from 0 through 9 and A through F. Your Excel document uses RGB (Red, Green, Blue) values, which are decimal. You can use the HEX2DEC function to convert each pair of hex digits to decimal. Here's what you do:

1. In three cells, enter each pair of digits from the color code. Enter an apostrophe before 07 to keep the leading zero.
2. Enter a formula of =HEX2DEC(B2). Excel will convert the FF to 255. This is the red value for the color in Excel.
3. Copy the function to the other two cells. The second value is the green value. The third value is the Blue value.
4. Select the area to be formatted.
5. Choose Home, Paint Bucket dropdown and choose More Colors. On the Custom tab of the Colors dialog, choose 255 for Red, 144 for Green, 7 for Blue. Click OK.

1. Use =HEX2DEC to convert the Web colors to RGB.