conditional formatting (more than 3 criteria's) - excel for beginners.pdf

4
Excel for Beginners Navigation Home Page -ExcelforBeginners Kristoff deCunha. Excel Formulas VBA CODES Miscellaneous AVERAGE Average of Average's AGE or TENURE CHARTS CONCATENATE CONDITIONAL FORMATTING CONDITIONAL FORMATTING (More than 3 Criteria's) CLEAN DATE GROUPS IF-THEN IF-THEN(MULTIPLE) IF-AND IF-OR PRODUCT(multiply) SUM (add) TRIM TIME CLOCK WITH AUTOMATIC REFRESH Vlookup VALIDATION SHORTCUT KEYS Sitemap Home Page -ExcelforBeginners-by Kristoff deCunha. > VBA CODES > CONDITIONAL FORMATTING (More than 3 Criteria's) CONDITIONAL FORMATTING (More than 3 Criteria’s) Use & Explanation: The steps below will show you how to do more than 3 conditional formattings in an excel sheet, which would otherwise allow you only 3 conditional formattings at any one time. The Cell colours will automatically change depending on the colour you have chosen for the Text or number you have specified as the criteria. STEPS IN DETAIL STEP On a New Excel Sheet, go to Tools, then go to Macro, then go to Visual Basic Editor. (Or you can also simply skip the step above and press the Alt key with the F11 key to open up the Visual Basic Editor) STEP 2 In the new screen that you see, Right click on the Sheet1, click on Insert, then click on Module. CONDITIONAL FORMATTING (More than 3 Criteria's) - Excel for B... https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit... 1 of 4 9/8/2014 11:59 AM

Upload: hassan-mehmood

Post on 07-Nov-2015

6 views

Category:

Documents


0 download

TRANSCRIPT

  • Excel for Beginners

    NavigationHome Page-ExcelforBeginnersKristoff deCunha.Excel FormulasVBA CODESMiscellaneousAVERAGEAverage ofAverage'sAGE or TENURECHARTSCONCATENATECONDITIONALFORMATTINGCONDITIONALFORMATTING (Morethan 3 Criteria's)CLEANDATEGROUPSIF-THENIF-THEN(MULTIPLE)IF-ANDIF-ORPRODUCT(multiply)SUM (add)TRIMTIMECLOCK WITHAUTOMATIC REFRESHVlookupVALIDATIONSHORTCUT KEYSSitemap

    Home Page -ExcelforBeginners-by Kristoff deCunha. > VBA CODES > CONDITIONAL FORMATTING (More than 3 Criteria's)

    CONDITIONAL FORMATTING (More than 3 Criterias)

    Use & Explanation:

    The steps below will show you how to do more than 3 conditional formattings in an excel sheet, which would otherwise allowyou only 3 conditional formattings at any one time.

    The Cell colours will automatically change depending on the colour you have chosen for the Text or number you havespecified as the criteria.

    STEPS IN DETAIL

    STEP

    On a New Excel Sheet, go to Tools, then go to Macro, then go to Visual Basic Editor. (Or you can also simply skip thestep above and press the Alt key with the F11 key to open up the Visual Basic Editor)

    STEP 2

    In the new screen that you see, Right click on the Sheet1, click on Insert, then click on Module.

    CONDITIONAL FORMATTING (More than 3 Criteria's) - Excel for B... https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...

    1 of 4 9/8/2014 11:59 AM

  • STEP 3 1,2

    IIn Module1, copy paste the code given below, into the blank screen on the right side of the screen, just as shown inthe snapshot.Now click on Sheet1 on the left side of the screen.Copy paste the code given below, here aswell.Save the sheet and close the entire sheet completely.

    Note: You can change all the data highlighted in red, in the code below, depending on what numbers or whattext, you would like to format in your excel sheet.

    For Example:

    To change the cell colour for the text ABCD & for the numbers in the range of 1 to 3 to a colour of your choice, simply changethe number mentioned in this portion of the code (oCell.Interior.ColorIndex = 3) which currently corresponds to thecolour red (see Color Table below) To change the Font size of the number 10 to Normal font, change the word True to False in this portion of thecode (oCell.Font.Bold = False)You can also delete the Text or Number criteria's you dont require, such as ABCD and numbers 1 to 3 for that you'll need to deletethese 3 lines of the code, like wise for any other criteria's as well :

    Case 1 To 3, "ABCD"

    oCell.Interior.ColorIndex = 3

    oCell.Font.Bold = True

    Private Sub Worksheet_Change(ByVal Target As Range)

    Dim oCell As Range

    For Each oCell In Target

    Select Case oCell.Value

    Case 1 To 3, "ABCD"

    oCell.Interior.ColorIndex = 3

    oCell.Font.Bold = True

    Case Is = 4, "EFGH"

    oCell.Interior.ColorIndex = 4

    oCell.Font.Bold = True

    Case 5 To 9, "IJKL"

    oCell.Interior.ColorIndex = 5

    oCell.Font.Bold = True

    Case Is = 10

    oCell.Interior.ColorIndex = 6

    oCell.Font.Bold = True

    CONDITIONAL FORMATTING (More than 3 Criteria's) - Excel for B... https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...

    2 of 4 9/8/2014 11:59 AM

  • Case Else

    oCell.Interior.ColorIndex = xlNone

    End Select

    Next oCell

    End Sub

    The Colour Table

    1 53 52 51 49 55 56

    9 46 12 10 5 47 16

    3 45 43 50 41 13 48

    7 44 6 4 33 54 15

    38 40 36 35 37 39 2

    A completed Conditional Formatting will look like this:

    A B C D E F G

    CONDITIONAL FORMATTING (More than 3 Criteria's) - Excel for B... https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...

    3 of 4 9/8/2014 11:59 AM

  • 1 ABCD 1 2 3

    2 EFGH 7

    3 IJKL 5 6 7 8 9

    4 10

    5

    6

    7

    8

    Sign in | Recent Site Activity | Report Abuse | Print Page | Powered By Google Sites

    CONDITIONAL FORMATTING (More than 3 Criteria's) - Excel for B... https://sites.google.com/site/excelforbeginners/Home/vba-codes/condit...

    4 of 4 9/8/2014 11:59 AM