简体   繁体   中英

row and column conditional formatting excel

Can anyone help me with the conditional formatting of the attached. I need to be able to type in the width and the drop in the separate cells to the table and the corresponding row and column highlight to cross over on the number needed.

I'm unsure of the formula needed but in short i need it to do the following: if row 4 col O is between 150 - 614 col D will highlight if row 4 col P is between 100 - 1014 row 4 will highlight and so on for the others.

attached image

重新格式化表格和结果的示例

If you are allowed to reformat your table slightly, you could use the following formula as your conditional formatting check. I placed the formula in all cells of the table so you can see what your two values evaluate to on the table. If you cannot split your table headers apart slightly then you need to modify the formula to ripping out the numbers from the string in order to make the comparison.

This is the formula I placed in all cells starting with top left cell in D5

=AND(AND($O$5>=D$3,$O$5<=D$4),AND($P$5>=$B5,$P$5<=$C5))

If you are stuck with a having to use the strings in your header and need something that looks like this:

字符串示例

then use following in cell D4 so you can see how it evaluates and copy it into your conditional formatting for a new rule:

=AND(AND($O$4>=--LEFT(D$3,FIND("mm",D$3)-1),
$O$4<=--MID(D$3,FIND("-",D$3)+2,FIND("m",D$3,FIND("-",D$3))-FIND("-",D$3)-2)),
AND($P$4>=--LEFT($C4,FIND("mm",$C4)-1),
$P$4<=--MID($C4,FIND("-",$C4)+2,FIND("m",$C4,FIND("-",$C4))-FIND("-",$C4)-2)))

NOTE: When setting up your conditional formatting rules, have all your entries selected and make sure the top left cell of your selection is the one with the whitish background.

Base your CF rule for D4:M11 on this formula.

range_labels_CF_rule


I'll edit this answer in a couple of days to put the formula into a code block.

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