Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-02-2012, 03:44 AM
tinfanide tinfanide is offline Any equiv. in Conditional Formatting??? Windows 7 64bit Any equiv. in Conditional Formatting??? Office 2010 32bit
Expert
Any equiv. in Conditional Formatting???
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Any equiv. in Conditional Formatting???

Code:
''' check if each cell in selection does not contain specific words


Dim oCell As Excel.Range
For Each oCell In Selection.Cells

    If InStr(1, oCell.Value, "Teacher", vbTextCompare) = 0 And InStr(1, oCell.Value, "Tutor", vbTextCompare) = 0 Then
        oCell.Interior.ColorIndex = 3
    End If

Next oCell

'''
Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Columns("A").Cells) Is Nothing Then
        If InStr(1, Target.Value, "Teacher", vbTextCompare) = 0 And InStr(1, Target.Value, "Tutor", vbTextCompare) = 0 Then
            Target.Interior.ColorIndex = 3
        Else
            Target.Interior.ColorIndex = 0
        End If
    End If
End Sub
'''
The above sets of codes do not auto check Column A every time.


I would prefer Conditional Formatting. But how can I do that like Conditional Formatting?
Can I do it without VBA?
Reply With Quote
  #2  
Old 06-03-2012, 10:10 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Any equiv. in Conditional Formatting??? Windows 7 32bit Any equiv. in Conditional Formatting??? Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

One way - the conditional formatting formula you could use to do this would be:

case insensitive
=COUNT(SEARCH({"teacher","tutor"},A1))=0

case sensitive
=COUNT(FIND({"Teacher","Tutor"},A1))=0
__________________
Colin

RAD Excel Blog

Last edited by Colin Legg; 06-03-2012 at 11:22 AM.
Reply With Quote
  #3  
Old 06-05-2012, 09:11 AM
tinfanide tinfanide is offline Any equiv. in Conditional Formatting??? Windows 7 64bit Any equiv. in Conditional Formatting??? Office 2010 32bit
Expert
Any equiv. in Conditional Formatting???
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by Colin Legg View Post
One way - the conditional formatting formula you could use to do this would be:

case insensitive
=COUNT(SEARCH({"teacher","tutor"},A1))=0

case sensitive
=COUNT(FIND({"Teacher","Tutor"},A1))=0
Thank you for your reply.
Please take a look at the attached file alongside with the questions below:
test.xlsx

Ques 1:
But in Excel 2010, it does not work in the conditional formatting formula as it returns something like "cannot use array in conditional formatting formula".

Ques 2:
In Column B, I want to know why Cell B2 returns a value error but B4 doesn't? Indeed, I think B2 shouldn't have returned a value error.

And
I have come up with a solution in Column E to avoid using array in the formula with the use of "AND".
Reply With Quote
  #4  
Old 06-05-2012, 02:38 PM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Any equiv. in Conditional Formatting??? Windows 7 32bit Any equiv. in Conditional Formatting??? Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Quote:
But in Excel 2010, it does not work in the conditional formatting formula as it returns something like "cannot use array in conditional formatting formula".
Yes, you're right. To work around that you have to use a name. Go to formulas tab > define name. Create a name called Instructors (or whatever you want to call it) which refers to ={"teacher","tutor"}

Then your conditional formatting rule becomes:
=COUNT(SEARCH(Instructors,$A1))=0

Quote:
Ques 2:
In Column B, I want to know why Cell B2 returns a value error but B4 doesn't? Indeed, I think B2 shouldn't have returned a value error.
In the workbook you attached these cells just have #VALUE! errors - no formulas. So I can't see the original formula / answer this question.
__________________
Colin

RAD Excel Blog
Reply With Quote
  #5  
Old 06-06-2012, 07:49 AM
tinfanide tinfanide is offline Any equiv. in Conditional Formatting??? Windows 7 64bit Any equiv. in Conditional Formatting??? Office 2010 32bit
Expert
Any equiv. in Conditional Formatting???
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by Colin Legg View Post
Yes, you're right. To work around that you have to use a name. Go to formulas tab > define name. Create a name called Instructors (or whatever you want to call it) which refers to ={"teacher","tutor"}

Then your conditional formatting rule becomes:
=COUNT(SEARCH(Instructors,$A1))=0



In the workbook you attached these cells just have #VALUE! errors - no formulas. So I can't see the original formula / answer this question.
Yes, you're right.
I should give a name to the array in 2010.
And you're very specialised in using Excel coz you can tell the little difference between 07 and 10.

And sorry. I don't know why the formula causing the error disappears. I cannot retrieve the formula though. Have to forget them.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any equiv. in Conditional Formatting??? Conditional Formatting. Laurie B. Excel 6 04-09-2012 05:01 PM
Conditional formatting zanat0s Excel 4 01-20-2012 03:30 AM
Any equiv. in Conditional Formatting??? Conditional formatting with AND, OR Lucky Excel 2 10-03-2011 11:41 PM
Conditional Formatting namedujour Excel 3 08-25-2011 01:46 PM
Any equiv. in Conditional Formatting??? help with conditional formatting Snvlsfoal Excel 3 07-03-2011 11:55 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft