+ Reply to Thread
Results 1 to 8 of 8

How to find highest value month wise with cell colour model

Hybrid View

  1. #1
    Forum Contributor PRADEEPB270's Avatar
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2016
    Posts
    332

    How to find highest value month wise with cell colour model

    I have an attachment file.
    In this file,sheet 1 is my query and sheet "result" is my desired solution.

    Can we find out in excel how to find the highest value month wise ( Prod.Qty and Sales Qty etc.) of a model with any cell colour ?
    Attached Files Attached Files
    Regards


    Pradeep Kumar Gupta
    Gurgaon ( INDIA )

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: How to find highest value month wise with cell colour model

    Try this, with you data starting "B4"
    Sub MG04Feb32
    Dim Rng As Range, Dn As Range, n As Long, Q As Variant, K As Variant
    Set Rng = Range(Range("B4"), Range("B" & Rows.Count).End(xlUp))
    Rng.Resize(, 4).Interior.ColorIndex = xlNone
    With CreateObject("scripting.dictionary")
    .CompareMode = vbTextCompare
    For Each Dn In Rng
       If Not .Exists(Dn.Value) Then
             Dn.Interior.ColorIndex = 6
            .Add Dn.Value, Array(Dn.Offset(, 2), Dn.Offset(, 3))
       Else
            Q = .Item(Dn.Value)
                If Dn.Offset(, 2).Value > Q(0) Then Set Q(0) = Dn.Offset(, 2)
                If Dn.Offset(, 3).Value > Q(1) Then Set Q(1) = Dn.Offset(, 3)
            .Item(Dn.Value) = Q
        End If
    Next
    For Each K In .keys
        .Item(K)(0).Interior.ColorIndex = 6
        .Item(K)(1).Interior.ColorIndex = 6
    Next K
    End With
    End Sub
    Regards Mick
    Last edited by MickG; 02-04-2017 at 12:32 PM.

  3. #3
    Forum Contributor PRADEEPB270's Avatar
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2016
    Posts
    332

    Re: How to find highest value month wise with cell colour model

    Thanks for the solution.

    But can it be apply for more than 2 columns.If yes,please see my fresh attachment and how can we do?
    Attached Files Attached Files

  4. #4
    Forum Contributor PRADEEPB270's Avatar
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2016
    Posts
    332

    Re: How to find highest value month wise with cell colour model

    can you help me to correct VBA codes in the same working ? How can it be apply on column F to J ? Please correct VBA codes working.
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: How to find highest value month wise with cell colour model

    May be
    Sub Test()
        Dim Rng As Range, Dn As Range, n As Long, Q As Variant, K As Variant, i As Long
    
        Application.ScreenUpdating = 0
            Set Rng = Range(Range("B4"), Range("B" & Rows.Count).End(xlUp))
            Rng.Resize(, 9).Interior.ColorIndex = xlNone
        
            With CreateObject("scripting.dictionary")
                .CompareMode = vbTextCompare
                For Each Dn In Rng
                    If Not .Exists(Dn.Value) Then
                        Dn.Interior.ColorIndex = 6
                        .Add Dn.Value, Array(Dn.Offset(, 2), Dn.Offset(, 3), Dn.Offset(, 4), Dn.Offset(, 5), Dn.Offset(, 6), Dn.Offset(, 7), Dn.Offset(, 8))
                    Else
                        Q = .Item(Dn.Value)
                        For i = 2 To 8
                            If Dn.Offset(, i).Value > Q(i - 2) Then Set Q(i - 2) = Dn.Offset(, i)
                            .Item(Dn.Value) = Q
                        Next i
                    End If
                Next
                For Each K In .keys
                    For i = 0 To 6
                        .Item(K)(i).Interior.ColorIndex = 6
                    Next i
                Next K
            End With
        Application.ScreenUpdating = 1
    End Sub
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  6. #6
    Forum Contributor PRADEEPB270's Avatar
    Join Date
    02-19-2010
    Location
    INDIA
    MS-Off Ver
    MSoffice-2016
    Posts
    332

    Re: How to find highest value month wise with cell colour model

    Thanks for the help.

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: How to find highest value month wise with cell colour model


  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: How to find highest value month wise with cell colour model

    You're welcome. Glad I can offer some help

+ 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] Using formulas show the ranking wise top products qty month and status wise
    By Chinnavenky in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-30-2016, 02:01 AM
  2. [SOLVED] Macro for Locations wise top model
    By Imrank in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 03-19-2015, 08:54 AM
  3. Getting Colour wise totals by changing font colour
    By Anuru in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-24-2014, 11:13 AM
  4. sum by month wise and staff wise horizontal and vertical
    By cjjimmy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-27-2014, 04:07 AM
  5. find a value, if more than one colour the highest value cell
    By jcthala in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-25-2013, 07:44 AM
  6. Supplier Wise month wise totaling
    By Hussain_smh in forum Excel General
    Replies: 3
    Last Post: 02-25-2012, 03:34 PM
  7. Plot data month-wise and month-wise
    By modest_16081982 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 10-08-2008, 04:44 AM

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