简体   繁体   中英

Dynamic range to be conditionally formatted based of cell value

I have 2 rows. 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. 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:

=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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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