ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Color fill based on multiple conditions (https://www.excelbanter.com/excel-programming/440645-color-fill-based-multiple-conditions.html)

C

Color fill based on multiple conditions
 
My spreadsheet contains subtotals.

A B C D E F
Production Line 1 10 1 5 2 10
Production Line 1 10 1 5 2 10
Production Line 1 Total 20 2 10 4 20

Some months the spreadsheet contains 100 lines and some months it contains
200. Does someone have some code that would loop through all the data in the
sheet and for each subtotaled line (when A contains Total), go to the same
row for B:F and if value is
less than 5, fill with orange
between 6 and 15, fill with blue
greater than 15, fill with green

I am using Excel 2003.

Blue Angel

Bernard Liengme[_2_]

Color fill based on multiple conditions
 
In A2:A10 I entered some text; a few had the word "Total"
In B2:F10 I entered some numbers
I select B2:F10 and in the Conditional Formatting dialog used
Formula IS: =AND($A2="Total", B2<5)
Format fill orange
Note the $ on A2. Because I selected down to row 10, the conditional
formatting applies to those rows also (so row 5 is =AND($A5="Total", B5<5) )
In pre-Excel2007 you can have up to 3 conditions
For more on the topic go to
See http://www.contextures.com/xlCondFormat01.html

best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme


"C" wrote in message
...
My spreadsheet contains subtotals.

A B C D E F
Production Line 1 10 1 5 2 10
Production Line 1 10 1 5 2 10
Production Line 1 Total 20 2 10 4 20

Some months the spreadsheet contains 100 lines and some months it contains
200. Does someone have some code that would loop through all the data in
the
sheet and for each subtotaled line (when A contains Total), go to the same
row for B:F and if value is
less than 5, fill with orange
between 6 and 15, fill with blue
greater than 15, fill with green

I am using Excel 2003.

Blue Angel




All times are GMT +1. The time now is 02:07 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com