Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

excel - Conditional format based on non-blank previous cell

I need to conditionally format cells in a row based on the prior non-blank cell

A    B    C    D    E    F    G
     AC             BW        IN
BW        BC        ST        IN

Because B1 is AC, i want C1 and D1 to have a conditional format (changed fill which will match the format in B1). That ends when i get to E1 and the value BW. On row 2 i want to ignore b2 and only format d2.

The values in that will turn the formatting on come from a list of values i.e. AC, BC, IC, SC.

currently i have conditional formatting that looks for the list and can format the individual cell but i don't understand how to create a vlookup type of event in the conditional formatting formula field, nor how to find the first non-blank to check

Edit: added the F and G columns to show that i want C1 and D1 to format but not F1 or F2, just the blank cells after the AC or BC.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use Aggregate:

=AND(COLUMN(A:A)>AGGREGATE(15,6,COLUMN($A1:$E1)/(ISNUMBER(MATCH($A1:$E1,{"AC","BC","IC","SC"},0))),1),A1="")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...