简体   繁体   English

动态范围要根据单元格值进行条件格式化

[英]Dynamic range to be conditionally formatted based of cell value

I have 2 rows. 我有2行。 One is the list of some names. 一种是一些名称的列表。 And the second row has a number. 第二行有一个数字。 I want the first row to be color formatted conditionally based on the value in row 2. So if in row 2 there is 3, then 3 cells in row 1 will get colored. 我希望根据第二行中的值对第一行进行有条件的颜色格式化。因此,如果第二行中有3个,则第一行中的3个单元格将被着色。 I have written a formula but it is somehow not working: 我已经写了一个公式,但是它不起作用: 在此处输入图片说明

Here's the formula: 公式如下:

=AND(B$1>=INDEX($B$1:$N$1,MATCH(1E+99,$B$2:B$2)),B$1<(TIME(HLOOKUP(1E+99,$B$2:B$2,1),0,0)+INDEX($B$1:$N$1,MATCH(1E+99,$B$2:B$2))))

Thank you 谢谢

Edit: 编辑:

Here are the screenshots: 这是屏幕截图:

在此处输入图片说明

在此处输入图片说明

Assuming the names are in row 1 and the numbers are in row 2, and that your data starts in column A, use this formula for your conditional format: 假设名称在第1行中,数字在第2行中,并且您的数据从A列开始,请使用以下公式作为条件格式:

=COLUMN(A2)-LOOKUP(2,1/(ISNUMBER($A2:A2)),$A2:A2)<LOOKUP(2,1/(ISNUMBER($A2:A2)),$A2:A2)

If your data starts in column B, then this is the conditional format formula you should use: 如果您的数据从B列开始,那么这是您应该使用的条件格式公式:

=COLUMN(B2)-LOOKUP(2,1/(ISNUMBER($B2:B2)),$B2:B2)-1<LOOKUP(2,1/(ISNUMBER($B2:B2)),$B2:B2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM