Recently we have published a few articles covering different aspects of Excel conditional formatting. Unexpectedly, it's turned out that it's not creating a rule and even not making a proper formula that represents the greatest challenge. Using proper cell references in Excel formulas appear to be the most complex part and a common source of problems. Show
"I had my conditional rule correct, except for the mixed references." This is what our blog readers have often reported in comments. So, why don't we invest a few minutes to figure this thing out? This will certainly save you far more time in the long run! How relative and absolute cell references work in conditional formatting rulesIn all Excel formulas, including conditional formatting rules, cell references can be of the following types:
In Excel conditional formatting, cell references are relative to the top-left cell in the applied range . So, when making a new rule, you can simply pretend as if you are writing a formula for the upper-left cell only, and Excel will "copy" your formula to all other cells in the selected range. If your formula refers to a wrong cell, a mismatch between the active cell and the formula will occur, which will result in conditional formatting highlighting wrong cells. Now, let me show you a few examples that demonstrate how seemingly identical formulas produce different results depending on what cell references types are used. Example 1. Absolute column and relative rowThis pattern is most typical for conditional formatting rules and in 90% of cases cell references in your Excel conditional formatting rules will be of this type. Let's make a very simple rule that compares values in columns A and B and highlights a value in column A if it is greater than a value in column B in the same row. If you need the detailed instructions on how to create conditional formatting rules with formulas, here you go - Creating an Excel conditional formatting rule using a formula. In this case, the formula is obvious:
Because you always compare values in columns A and B, you "fix" these column by using absolute column references, notice the $ sign before the column letters in the above formula. And, since you are comparing the values
in each row individually, you use relative row references, without $. Example 2. Relative column and absolute rowThis cell reference type is the opposite of the previous one. In this case, the row number is always constant while the column changes. You use such references when you want to check values in a given row against a certain value or against values in another row. For example, the below formula compares values in row 1 and 2 and the rule highlights a value in row 1 if it is greater than a value in row 2 in the same column:
Because you want the row numbers to be fixed, you use the absolute row references, with the $ sign. And, because you want to compare values in each column individually, you create the rule for the left-most column (A) and use relative column references, without the $ sign. Example 3. Absolute column and absolute rowYou use absolute row and absolute column references if you want to compare all values in the selected range with some other value. For example, let's create a rule that highlights all values in column A that are greater than a value in cell B1. The formula is as follows:
Please pay attention to the use of the following references:
Example 4. Relative column and relative rowThis reference type is used in Excel conditional formatting rules least of all. You use relative column & relative row references when you want to check all cells of the selected range against a certain value. Suppose, you want to highlight all cells in columns A and B that are greater than a value in cell B1. You can simply copy the formula from the previous example and replace $A1 with A1 since you do not want to fix either row or column:
Remember, you write the formula for the top-left cell in your range, A1 in our case. When you create a rule with the above formula and apply it to some range, say A1:B10, the result will look similar to this: Tip. To quickly toggle between absolute and relative references, select the cell reference in the formula bar and press the F4 function key. The reference will rotate between the four types from relative to absolute, like this: A1 > $A$1 > A$1 > $A1, and then back to the relative reference A1. Useful resourcesHopefully, these simples examples have helped you fathom out the essence of relative and absolute cell references in Excel. Now that you know how to determine the appropriate reference type for your rules, go ahead and harvest the power of Excel conditional formatting for your projects. The following resources may prove helpful:
How do you enter a formula using relative cell references that adds values in Excel?Use cell references in a formula. Click the cell in which you want to enter the formula.. In the formula bar. , type = (equal sign).. Do one of the following, select the cell that contains the value you want or type its cell reference. ... . Press Enter.. How do you construct a formula that adds the values in the range?You'd press Enter to get the total of 39787. To create the formula: Type =SUM in a cell, followed by an opening parenthesis (.
...
Give it a try.. Which formula uses relative cell references?Relative Cell References
This is the most widely used type of cell reference in formulas. Relative cell references are basic cell references that adjust and change when copied or when using AutoFill. Example: =SUM(B5:B8), as shown below, changes to =SUM(C5:C8) when copied across to the next cell.
What is a relative range reference in Excel?By default, a cell reference is a relative reference, which means that the reference is relative to the location of the cell. If, for example, you refer to cell A2 from cell C2, you are actually referring to a cell that is two columns to the left (C minus A)—in the same row (2).
|