基于单元格动态条件格式化行 [英] Conditional formatting rows based on cell dynamic
问题描述
我想知道如果有人可以帮助一个条件格式问题,我只是不能包围我的头
我们目前有一个名称在和下一个给名字一个号码
Bob 5
Michael 6
现在,如果我在单元格A1中键入bob,我希望突出显示该行以及它下面的四个行。
另一个例子是,如果我在单元格A1中键入Michael,它会突出显示那行和下面的5行
任何帮助表示赞赏
我不能写一个更简单的公式,但是那个与我测试的数据一起工作。
<
表格的范围从C1到D7(假设没有列标签)。
选择表格C1到D7,并用公式插入条件格式,并使用公式:
= AND(COUNTIF(OFFSET(C1,IF(ROW() - VLOOKUP($ A $ 1,$ C $ 1:$ d $ 7,2,0)< = 0,1-ROW(),1- VLOOKUP($ A $ 1 ,$ C $ 1:$ d $ 7,2,0)),0,VLOOKUP($ A $ 1,$ C $ 1:$ d $ 7,2,0)),$ A $ 1)大于0,ROW()> = MATCH($ A $ 1,C:C,0))
然后选择你想要的格式。
公式检查两个条件:
COUNTIF(OFFSET(C1 ,IF(ROW() - VLOOKUP($ A $ 1,$ C $ 1:$ d $ 7,2,0)< = 0,1-ROW(),1- VLOOKUP($ A $ 1,$ C $ 1:$ d $ 7,2,0)),0,VLO OKUP($ A $ 1,$ C $ 1:$ D $ 7,2,0),$ A $ 1)> 0
这将根据D中的值检查指定范围内是否至少有一次匹配。它将检查上面是否存在匹配 x
行其中 x
是当前行。如果有,我们得到第一个布尔值(true或false)。
$ b
第二个 ROW()> = MATCH($ A $ 1,C:C,0)
确保匹配位于当前行之上或之上。 /docs.google.com/spreadsheets/d/1dsvV5qSZs5VTc_uDIw95LRjM8IiFhvpUTScmB8AdnFc/edit?usp=sharingrel =nofollow> Google电子表格演示
I’m wondering if someone can assist with a conditional formatting issue i just can't wrap my head around
We currently have a table with names in and next to the name a number
Bob 5
Michael 6
Now if i type bob in cell A1 i would like it to highlight that row and the four below it. another example would be if i type Michael in cell A1 it would highlight that row and 5 below that
any help is appreciated
I couldn't write a simpler formula, but that one worked with the data I tested.
A1 will be where names will be inserted.
The table will range from C1 to D7 (assuming there are no column labels).
Select the table C1 to D7 and insert conditional formatting with formula and use the formula:
=AND(COUNTIF(OFFSET(C1,IF(ROW()-VLOOKUP($A$1,$C$1:$D$7,2,0)<=0,1-ROW(),1-VLOOKUP($A$1,$C$1:$D$7,2,0)),0,VLOOKUP($A$1,$C$1:$D$7,2,0)),$A$1)>0,ROW()>=MATCH($A$1,C:C,0))
And pick the formatting your want.
The formula checks two conditions:
COUNTIF(OFFSET(C1,IF(ROW()-VLOOKUP($A$1,$C$1:$D$7,2,0)<=0,1-ROW(),1-VLOOKUP($A$1,$C$1:$D$7,2,0)),0,VLOOKUP($A$1,$C$1:$D$7,2,0)),$A$1)>0
This checks if there is at least 1 match within a designated range depending of the value in D. It will check if there is a match x
rows above the current row where x
is the value. If there is, the we get the first boolean value (true or false).
The second ROW()>=MATCH($A$1,C:C,0)
ensures that the match is above or on the current row.
这篇关于基于单元格动态条件格式化行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!