• Excel Book Excerpt

Excel Match Web Colors with HEX2DEC

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.

Match Web Colors with HEX2DEC

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.


Figure 381 Use =HEX2DEC to convert the Web colors to RGB.

Additional Details: To convert RGB values to hexadecimal, you use DEC2HEX.


<-Previous Topic Next Topic->

For more resources for Microsoft Excel:

privacy policy