Conditonal formatting

lefty78312

Active Member
Joined
Oct 25, 2007
Messages
275
I'm looking for a formula to use with conditional formatting that highlights cells if any of more than 3 conditions is met. I saw it on this forum before, but I can't find it with a search. It was something like <code>=or(condition1),or(condition2)</code>, etc. Can anyone help me with this?
 

Some videos you may like

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
43,446
Office Version
365
Platform
Windows
I'm looking for a formula to use with conditional formatting that highlights cells if any of more than 3 conditions is met. I saw it on this forum before, but I can't find it with a search. It was something like <code>=or(condition1),or(condition2)</code>, etc. Can anyone help me with this?
If you just want the one colour if any of the conditions are met, you just need in the CF 'Formula is' section...
=OR(condition1, condition2, condition3,...)

If you need more specific help, tell us about the required conditions and the range it is to be applied to.
 

lefty78312

Active Member
Joined
Oct 25, 2007
Messages
275
Thank you Ralph and Peter. The <code>=Or</code> solution is the one I had seen previously, and that's the one I was looking for. Although I will try the other one as well.

Just for chuckles, what would be the syntax for a CF that required two or more conditions to be met?
 
Last edited:

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
43,446
Office Version
365
Platform
Windows
Just for chuckles, what would be the syntax for a CF that required two or more conditions to be met?
=AND(condition1, condition2, ...)
 

lefty78312

Active Member
Joined
Oct 25, 2007
Messages
275
Thank you again, Peter. I just got home and tried the formula you posted yesterday, and it don't work. My worksheet needs to show if the value in the cells is equal to or greater than 2.0GB. and here's the trick: <u>I have to make the 'GB' part of the cell contents.</u> The cell values are specific, known in advance responses that I enter into the formula. If they change, which they might occasionally, I just change the formula. Here's what I have: <code>=OR(2GB,2.5GB,3GB,3.3GB)</code>. Excel immediately returns the message 'The formula you typed contains an error' and changes the formula to something that doesn't work. Where am I going wrong?
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
43,446
Office Version
365
Platform
Windows
Thank you again, Peter. I just got home and tried the formula you posted yesterday, and it don't work. My worksheet needs to show if the value in the cells is equal to or greater than 2.0GB. and here's the trick: <u>I have to make the 'GB' part of the cell contents.</u> The cell values are specific, known in advance responses that I enter into the formula. If they change, which they might occasionally, I just change the formula. Here's what I have: <code>=OR(2GB,2.5GB,3GB,3.3GB)</code>. Excel immediately returns the message 'The formula you typed contains an error' and changes the formula to something that doesn't work. Where am I going wrong?
Two things...

1. You have to say which cell has to = 2GB etc, and

2. I assume the 2GB is a text value so it will need "" around it in the formula.

So, assuming the value is in cell A1 and also it is A1 that you want to conditionally format, the formula you would need in the CF for cell A1 would be:
=OR(A1="2GB",A1="2.5GB",A1="3GB",A1="3.3GB")
 

lefty78312

Active Member
Joined
Oct 25, 2007
Messages
275
Two things...

1. You have to say which cell has to = 2GB etc, and

2. I assume the 2GB is a text value so it will need "" around it in the formula.

So, assuming the value is in cell A1 and also it is A1 that you want to conditionally format, the formula you would need in the CF for cell A1 would be:
=OR(A1="2GB",A1="2.5GB",A1="3GB",A1="3.3GB")
First of all, thank you for your patience in hanging in there with me. I forgot to tell you; there are actually several cells in the column that the info may appear in. Specifically, it appears in e2, e4 and e6. I ended up modifying the formula you suggested <code>=OR(E2,E4,E6="2.0GB",E2,E4,E6="2.5GB",E2,E4,E6="3.0GB".E2,E4,E6="3.3GB")</code>. Again, many thanks for your assistance. You've not only helped me solve my little problem; I learned something.
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Just a suggestion. You can custom format your cells of interest
Code:
General "GB"
Now you can just enter the numbers and the GB will be displayed, though the cell will still be a number.

lenze
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
43,446
Office Version
365
Platform
Windows
I ended up modifying the formula you suggested =OR(E2,E4,E6="2.0GB",E2,E4,E6="2.5GB",E2,E4,E6="3.0GB".E2,E4,E6="3.3GB")
Unless I have misunderstood your requirement, I don't believe that formula will do what you want. First, let's assume the red dot I have highlighted was a typo and should have been a comma.

This CF formula (if applied in cell E2) would format E2 if

- E2 contains any number except 0 (see Example 1), or

- E4 contains any number except 0, even if E2 contains something you are not interested in (see Example 2), or

- E6 contains one of the three "GB" text entries, even if E2 contains something you are not interested in (see Example 3)

Note that I have only applied Conditional Formatting to 1 cell (E2) but, as I interpret what you want, I don't think any of those three results are what you want.

Excel Workbook
E
1
2275.68
3
4
5
6
Example 1
#VALUE!



Excel Workbook
E
1
2xyz
3
45000
5
6
Example 2
#VALUE!




Excel Workbook
E
1
2xyz
3
4
5
63.0GB
Example 3
#VALUE!
 

Forum statistics

Threads
1,089,320
Messages
5,407,563
Members
403,152
Latest member
Junaid Azhar

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top