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:
- In three cells, enter each pair of digits from the color code. Enter an apostrophe before 07 to keep the leading zero.
- Enter a formula of =HEX2DEC(B2). Excel will convert the FF to 255. This is the red value for the color in Excel.
- Copy the function to the other two cells. The second value is the green value. The third value is the Blue value.
- Select the area to be formatted.
- 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.
- Use =HEX2DEC to convert the Web colors to RGB.
Additional Details: To convert RGB values to hexadecimal, you use DEC2HEX.
Historically, Excel offered functions to convert between Binary, Octal, Decimal, and Hexadecimal. Excel 2013 introduces two new flexible functions that handle all numbering systems from Binary (Base 2) to Base 36. To convert from a number in Base 16 to Decimal, use =DECIMAL("B2",16). To convert from decimal 144 to Hexadecimal, use =BASE(144,16).