# How do I reference cells in Excel with a COUNTIF() condition?

Use Excel's flexible COUNTIF() function to count entries based on a condition that includes a cell reference.

Counting values is an easy task using Excel's COUNTIF() function. This function counts the number of cells in a range that meet a specific condition. You supply the range and a condition, which can be a literal value or a expression. Today, we'll combine the two—sort of. Let's suppose you want to know the number of people who surpassed last year's top commission in the spreadsheet below. In this case, the range is the commission totals in cells B7:E7. The condition is any value that's greater than last year's top commission. Let's say that value is \$12,500. In Excel language, that's >12500. Now, let's transfer all that to the actual sheet. As you can see below, the COUNTIF() functions (B11 and B12) return 1 and 3

`=COUNTIF(B7:E7,">12500")`
`=COUNTIF(B7:E7,"<=12500")` Be sure to wrap the conditional expression in quotation marks. Only one salesperson surpassed last year's top commission; three were equal to or less than last year's top commission.

`=COUNTIF(B7:E7,">" & B10)`
`=COUNTIF(B7:E7,"<=" & B10)`