[英]Conditionally format column A if cell row contains “z”
I want to highlight cells in column A (using the conditional formatting tool) if the cell's corresponding row contains the letter z
anywhere within that row. 如果单元格的对应行在该行中的任何位置包含字母
z
,我想突出显示A列中的单元格(使用条件格式设置工具)。 I want to do this so I can sort data to the top if it is highlighted in column A. 我想这样做,因此如果数据在A列中突出显示,我可以将其排序到顶部。
I'm using the formula: 我正在使用公式:
=COUNTIF($A1:$AA1,"*z*")
But I don't want to highlight the entire row, just the corresponding cell in column A for that row. 但是我不想突出显示整个行,而仅突出显示该行的A列中的相应单元格。
What is the formula to do this? 这样做的公式是什么?
Select ColumnA then HOME > Styles - Conditional Formatting, New Rule..., Use a formula to determine which cells to format and Format values where this formula is true: : 选择ColumnA,然后选择HOME>样式-条件格式,新规则..., 使用公式确定要格式化的单元格,并在此公式为true的情况下设置值的 格式 :
=COUNTIF($A1:$AA1,"*z*")>0
Format... , select highlighting OK, OK. 格式... ,选择突出显示的确定,确定。
This will apply only to Column A (because of the selection). 这仅适用于列A(由于选择)。
This seemed to work for me when testing with a 3x3 cell table: 在使用3x3单元格表进行测试时,这似乎对我有用:
Formula: 式:
=COUNTIF($B1:$C1," z ") = COUNTIF($ B1:$ C1,“ z ”)
Then only cells in A were highlighted. 然后,仅突出显示A中的单元格。
"I want to do this so I can sort data to the top if it is highlighted in column A."
“我想这样做,以便如果数据在A列中突出显示,则可以将其排序到顶部。”
Ok, first of all, you don't need to use conditional formatting to sort. 好的,首先,您不需要使用条件格式进行排序。 Second of all you wouldn't want to reference A1 in your formula
=COUNTIF($A1:$AA1,"z")
- it is a circular reference and any formula you put in column A would not return "z" anyways because you are using it for your COUNTIF formula. 第二,您不想在公式
=COUNTIF($A1:$AA1,"z")
引用A1-这是一个循环引用,您放在A列中的任何公式都不会返回“ z”,因为您正在将其用于您的COUNTIF公式。
The formula you want to use is: 您要使用的公式是:
=IF(COUNTIF($B1:$AA1,"z")>0,1,0)
If you want to look for any row that contains az anywhere in a string you would want to do a wildcard countif: 如果要查找字符串中任意位置包含z的任何行,则需要执行通配符计数:
=IF(COUNTIF($B1:$AA1,"*z")>0,1,0)
Then you can just sort on column A for all your data - high to low. 然后,您可以对所有数据从A列进行排序-从高到低。
Basically you have demonstrated a basic misunderstanding of how to sort in excel(no offense). 基本上,您已经表现出对如何按excel排序的基本误解(无冒犯)。 This should help you.
这应该对您有帮助。 Good Luck.
祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.