Excel conditional format or formula help
Closed
jen
-
1 Nov 2011 à 16:10
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 2 Nov 2011 à 00:13
venkat1926 Posts 1863 Registration date Sunday 14 June 2009 Status Contributor Last seen 7 August 2021 - 2 Nov 2011 à 00:13
Related:
- Excel conditional format or formula help
- Number to words in excel formula - Guide
- Excel color formula - Guide
- Formula to calculate vat in excel - Guide
- Date formula in excel dd/mm/yyyy - Guide
- Excel conditional formatting based on date - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday 14 June 2009
Status
Contributor
Last seen
7 August 2021
811
2 Nov 2011 à 00:13
2 Nov 2011 à 00:13
in excel 2003 or earlier versions conditional formatting (format-conditionaformatting) can work on only three conditions. so a macro is required.
I do not know whether by a formula you can color a cell.
so if you want to put a number in colulmn C then you can do it
suppose the data is as follows from A1
1 62
9 76
3 43
10 71
3 70
8 96
2 52
1 93
9 64
1 74
then in C1 copy this formula
=IF(AND(A1>=2,B1>=80),2,IF(AND(A1>=2,B1<80),1,IF(AND(A1<2,B1>=80),1,IF(AND(A1<2,B1>=80),0,""))))
copy C1 down
if you are interested only in color run this macro
keep the sheet as active sheet and run the macro
I do not know whether by a formula you can color a cell.
so if you want to put a number in colulmn C then you can do it
suppose the data is as follows from A1
1 62
9 76
3 43
10 71
3 70
8 96
2 52
1 93
9 64
1 74
then in C1 copy this formula
=IF(AND(A1>=2,B1>=80),2,IF(AND(A1>=2,B1<80),1,IF(AND(A1<2,B1>=80),1,IF(AND(A1<2,B1>=80),0,""))))
copy C1 down
if you are interested only in color run this macro
keep the sheet as active sheet and run the macro
Sub test()
Dim r As Range, c As Range
Set r = Range(Range("A1"), Range("A1").End(xlDown))
For Each c In r
If c >= 2 And c.Offset(0, 1) >= 80 Then c.Offset(0, 2).Interior.ColorIndex = 4
If c >= 2 And c.Offset(0, 1) < 80 Then c.Offset(0, 2).Interior.ColorIndex = 6
If c < 2 And c.Offset(0, 1) Then c.Offset(0, 2).Interior.ColorIndex = 6
If c < 2 And c.Offset(0, 1) < 50 Then c.Offset(0, 2).Interior.ColorIndex = 3
Next c
End Sub