+ Reply to Thread
Results 1 to 16 of 16

Require flexible conditional formatting

  1. #1
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Exclamation Require flexible conditional formatting

    HI,

    I need to standardised a formula for conditional formatting using data bar for the salary column.
    Take for example,
    Where Qualification = DPL (L2), Salary Range : 2800 - 3500, so where my salary, i.e. 3500 will show a data bar ( max )
    Where Qualification = DPT, Salary Range : 2500 - 3500, so where my salary, i.e. 3000 will show a data bar ( in the middle )
    Where Qualification = DPT (L2), Salary Range : 2000 - 3000, so where my salary, i.e. 2000 will show a data bar ( EMPTY )
    Where Qualification = DPT (L1), Salary Range : 1500 - 2500, so where my salary, i.e. 2200 will show a data bar ( close to max )
    Where Qualification = Basic, Salary Range : 1000 - 2250, so where my salary, i.e. 1200 will show a data bar ( close to min )
    Where Qualification = CIT, Salary Range : 1250 - 1750, so where my salary, i.e. 1500 will show a data bar ( in the middle )

    I want to make this conditional formatting flexible such that when i select a particular qualification, the salary range will change accordingly.
    And then the salary data bar will then change too.

    I have already attached a sample workbook. Please help! Need this urgently SAMPLE HELP CONDITIONAL FORMATTING.xlsx

  2. #2
    Valued Forum Contributor
    Join Date
    04-09-2013
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2010
    Posts
    391

    Re: Require flexible conditional formatting

    See the file, Rule applied to F2 and F3, repeat the same for all the cells.
    Attached Files Attached Files

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Require flexible conditional formatting

    Pl see the attached file.
    Worksheet_change event is used
    Attached Files Attached Files

  4. #4
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Cool Re: Require flexible conditional formatting

    Here is the code for Fast Conditional formatting as you demanded..
    Please Login or Register  to view this content.
    Just a recorded macro with some changes...
    Check the attached file and tell is that what your were trying to achieve..
    Attached Files Attached Files
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  5. #5
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Require flexible conditional formatting

    Quote Originally Posted by kvsrinivasamurthy View Post
    Pl see the attached file.
    Worksheet_change event is used
    I tried. but couldn't see the data bar. the value is intact.
    am i suppose to do anything else besides copy and paste and modify the code & conditional formatting ( insert formula )

  6. #6
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Require flexible conditional formatting

    Quote Originally Posted by Vikas_Gautam View Post
    Here is the code for Fast Conditional formatting as you demanded..
    Please Login or Register  to view this content.
    Just a recorded macro with some changes...
    Check the attached file and tell is that what your were trying to achieve..

    I tried. but couldn't see the data bar. the value is intact.
    am i suppose to do anything else besides copy and paste and modify the code & conditional formatting ( insert formula )

  7. #7
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Require flexible conditional formatting

    You have to just copy and paste the code and run the code...
    and the other thing to have to ensure is that the Original file layout must match one that you provided in the example file
    OTHERWISE we have to change our code accordingly...

    thanks..

    Regards,

  8. #8
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Require flexible conditional formatting

    Quote Originally Posted by Vikas_Gautam View Post
    You have to just copy and paste the code and run the code...
    and the other thing to have to ensure is that the Original file layout must match one that you provided in the example file
    OTHERWISE we have to change our code accordingly...

    thanks..

    Regards,
    Hi what do you mean by the difference in layout?

    i edited to fit mine:

    Sub ConFormat()
    For r = 2 To Cells(Rows.Count, "M").End(xlUp).Row
    Cells(r, "M").Select
    Selection.FormatConditions.AddDatabar
    Selection.FormatConditions(Selection.FormatConditions.Count).ShowValue = True
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1)
    .MinPoint.Modify newtype:=xlConditionValueFormula, newvalue:= _
    "=INDEX(Sheet7!$E$19:$E$24,MATCH(Sheet4!$J$" & r & ",Sheet7!$D$19:$D$24,0))"
    .MaxPoint.Modify newtype:=xlConditionValueFormula, newvalue:= _
    "=INDEX(Sheet7!$F$19:$F$24,MATCH(Sheet4!$J$" & r & ",Sheet7!$D$19:$D$24,0))"
    End With
    With Selection.FormatConditions(1).BarColor
    .Color = 13012579
    .TintAndShade = 0
    End With
    Selection.FormatConditions(1).BarFillType = xlDataBarFillSolid
    Selection.FormatConditions(1).Direction = xlContext
    Selection.FormatConditions(1).NegativeBarFormat.ColorType = xlDataBarColor
    Selection.FormatConditions(1).BarBorder.Type = xlDataBarBorderNone
    Selection.FormatConditions(1).AxisPosition = xlDataBarAxisAutomatic
    With Selection.FormatConditions(1).AxisColor
    .Color = 0
    .TintAndShade = 0
    End With
    With Selection.FormatConditions(1).NegativeBarFormat.Color
    .Color = 255
    .TintAndShade = 0
    End With
    Next
    End Sub


    However, it doesn't work.

  9. #9
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Require flexible conditional formatting

    Can you post your original file...?
    I think this needs personalized implementation...


    Regards,

  10. #10
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Require flexible conditional formatting

    SAMPLE CONDITIONAL FORMATTING ( MORE REAL).xlsx

    Here it is. I have placed in the exact position. So this will do :D
    pls do help! thanks

  11. #11
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Require flexible conditional formatting

    Pl see attached file

  12. #12
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Require flexible conditional formatting

    Quote Originally Posted by kvsrinivasamurthy View Post
    Pl see attached file
    It says subscript out of range in the following highlighted area when i debugged it.


    Sub Macro2()
    '
    ' Macro2 Macro

    Sheets("Sheet4").Select
    Range("M2").Select
    Selection.FormatConditions.AddDatabar
    Selection.FormatConditions(Selection.FormatConditions.Count).ShowValue = True
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1)
    .MinPoint.Modify newtype:=xlConditionValueLowestValue
    .MaxPoint.Modify newtype:=xlConditionValueHighestValue
    End With
    With Selection.FormatConditions(1).BarColor
    .Color = 8700771
    .TintAndShade = 0
    End With
    End Sub

  13. #13
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Require flexible conditional formatting

    Quote Originally Posted by kvsrinivasamurthy View Post
    Pl see attached file
    It also says that i can't execute code in break mode. What is this suppose to mean?

  14. #14
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Require flexible conditional formatting

    Do not use macros .Delete them. worksheet_Change event is used for conditional formatting . when change is done in J column F column cell will be conditionally formatted.

  15. #15
    Registered User
    Join Date
    10-10-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    54

    Re: Require flexible conditional formatting

    Quote Originally Posted by kvsrinivasamurthy View Post
    Do not use macros .Delete them. worksheet_Change event is used for conditional formatting . when change is done in J column F column cell will be conditionally formatted.
    i have done as you have instructed.
    But the data bar is not reflected because there is no conditional formatting rules. ( i've compared to the file you have sent )

  16. #16
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Require flexible conditional formatting

    Pl upload your file having problem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formual require for formatting the text columns.
    By kasi.maddula in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-31-2013, 11:38 PM
  2. Formual require for formatting the text columns.
    By kasi.maddula in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-31-2013, 06:08 AM
  3. Does this action require >>>Conditional Formatting????
    By thursday140 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-04-2013, 09:59 AM
  4. conditional sum: can I make the array flexible
    By jash147 in forum Excel General
    Replies: 4
    Last Post: 11-02-2007, 02:25 AM
  5. Would this require a program in EXCEL? multiple conditional statements
    By John David in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-19-2006, 04:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1