Conditional formatting for a column based on the value of header

一个人想着一个人 提交于 2019-12-13 05:52:20

问题


I have several columns where the data from rows 7 onwards changes depending on the selection made from a dropdown menu in row 6. Most of these options will result in textual or number based values appearing, but two of them would need to be formatted as currency.

Essentially what I want is a conditional formatting formula that says; if row six in any column has a value of “Implied Unit Rate” or “Annual budget”, format rows 7 and onwards in that column as currency.

I can get this to work by creating two separate conditional formatting formulas and applying them both to the whole area, but it seems like there should be a way to do it in a single formula.

My current formulas, applied as two separate rules:

=INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget"

=INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate"

How I think it should work when applied as one rule:

=OR(INDIRECT(ADDRESS(6,COLUMN(),1))="Annual Budget", INDIRECT(ADDRESS(6,COLUMN(),1))="Implied Unit Rate")

When I enter the combined formula in a regular cell within the worksheet, it does return true as expected, but does nothing when I apply it as a conditional formatting rule. Any ideas? Thanks in advance!


回答1:


Now I may be mis interpreting what Scott is saying, so I am going to say this in my own words.

Your condition check on the cell address in question is a little "verbose". In order to apply your conditional formatting, select the range you want to apply your condition formatting to first. Lets arbitrarily say select range A7 to D42. After selecting the appropriate range, ensure cell A7 is the active cell of the selected range. This usually means there is a border around A7 to D42 and all cells but A7 have been slightly greyed to indicate that they have been selected, and A7 will have a brighter background to indicate that it is the active cell. With all that still in effect, select your conditional formatting.

In conditional formatting choose formula as the option (last one at the bottom) to control how your formatting will be applied. In the region where you can enter your formula, enter the following:

=OR(A$6="Annual Budget", A$6="Implied Unit Rate")

The $ will keep the row and column reference from changing as it is applied to each cell in the range. It will always be checking row 6 of what ever column the cell is in. The column A reference is relative to the active cell.



来源:https://stackoverflow.com/questions/37288092/conditional-formatting-for-a-column-based-on-the-value-of-header

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!