You are here:

# Excel/conditional formatting

Question
Dear Sir,
Cell A1:A12 I have formula =randbetween(1,21)
cell C1=1,cell C2=2,cell C3=3,cell D1=4,cell D2=5,cell D3=6....cell I1=19, cell I2=20, cell I3=21. This is my layout. My question is i want to conditional format and fill with yellow only those cells within range C1:I3 whose value matches with A1:A12. Please show me what formula i put in conditional format to achive this.

Thanks.

Hi Sahil,

You didn't mention what version of Excel you are using.  Here are the instructions for Excel 2007 (previous versions might be a little different).

Select the range C1:I3.  Then select Conditional Formatting in the Styles group of the Home ribbon tab.  Select the New Rule option.  Then in the Select a Rule Type box select >Use a formula to determine which cells to format.  In the Rule Description box enter the formula

=COUNTIF(\$A\$1:\$A\$12,C1)

Then of course you will need to select the yellow highlighting in the Format box.

That should do it.

Damon
Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment the answer is perfect and to the point

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Damon Ostrander

##### Expertise

I have extensive experience with VBA programming in Excel 5 through Excel 2013. As a former aerospace engineer with a large aerospace corporation and consultant in a small defense technology services company, I have developed a wide range of applications in VBA, including simulations involving mixed-language programming, satellite orbit mechanics, graphics and animation, and real-time applications. I am interested in moderate to hard VBA-related questions only.

##### Experience

I have developed and taught several courses in Excel VBA programming and also VBA programming in Office 97, 2000, and 2007. I have developed a number of large technical applications in Excel VBA for use within the aerospace industry.

Education/Credentials
B.S. in Electrical Engineering and Computer Science, University of California, Berkeley.