Results 1 to 30 of 30

Look up column and Extract and print maximum value and beside cell value

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-16-2013
    Location
    World
    MS-Off Ver
    Excel 2007
    Posts
    215

    Question Look up column and Extract and print maximum value and beside cell value

    Dear masters,

    i need one code for Lookup entire column, extract maximum value and beside cell value to another cells and need one output column(U).i have one good code. please modify for this correction.
    i have tried but not successful. so kindly make a modification. my code is as below:

    Sub Generate()
        Application.ScreenUpdating = False
        LR = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
        For i = 4 To LR
            If Range("A" & i) <> Range("A" & i - 1) Then
                BeamRow = Sheet1.Cells(Rows.Count, "M").End(xlUp).Row + 1
                Range("M" & BeamRow) = Range("A" & i)
            End If
        Next i
        LastRow = Sheet1.Cells(Rows.Count, "M").End(xlUp).Row
        On Error Resume Next
        Range("E4:E" & LR & ",G4:G" & LR).SpecialCells(xlCellTypeConstants, 2).ClearContents
        Sheet1.Range("N4:N" & LastRow).Formula = "=MAX(INDEX(($A$4:$A$" & LR & "=$M4)*($E$4:$E$" & LR & "),,))"
        Sheet1.Range("O4:O" & LastRow).Formula = "=MAX(INDEX(($A$4:$A$" & LR & "=$M4)*($G$4:$G$" & LR & "),,))"
        Sheet1.Range("P4:P" & LastRow).Formula = "=MIN(INDEX(($A$4:$A$" & LR & "=$M4)*($E$4:$E$" & LR & "),,))"
        Sheet1.Range("Q4:Q" & LastRow).Formula = "=MIN(INDEX(($A$4:$A$" & LR & "=$M4)*($G$4:$G$" & LR & "),,))"
        Sheet1.Range("R4:R" & LastRow).Formula = "=IF($N4<$O4,""MY"",IF($N4>$O4,""MZ"",""Same""))"
        Sheet1.Range("T4:T" & LastRow).Formula = "=IF($P4>$Q4,""MY"",IF($P4<$Q4,""MZ"",""Same""))"
        Sheet1.Range("W4:W" & LastRow).Formula = "=IF(MAX($N4:$Q4)>MIN($N4:$Q4)*-1,MAX($N4:$Q4),MIN($N4:$Q4))"
        Sheet1.Range("V4:V" & LastRow).Formula = "=INDEX($N$3:$Q$3,MATCH($W4,$N4:$Q4,0))"
        Sheet1.Range("N4:W" & LastRow).Value = Sheet1.Range("N4:W" & LastRow).Value
        Range("E4:E" & LR & ",G4:G" & LR).SpecialCells(xlCellTypeBlanks).Value = "N/A"
        Application.ScreenUpdating = True
    End Sub
    please find sample output file of Excel file.

    thanking you,
    Best regards.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Filter to extract the maximum value for each ID
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-19-2016, 03:29 AM
  2. [SOLVED] Extract Minimum and maximum dates against values in adjucent column
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2015, 01:35 AM
  3. Replies: 7
    Last Post: 10-07-2015, 03:01 PM
  4. Replies: 4
    Last Post: 07-08-2015, 06:31 AM
  5. Print hundreds of 6 column charts using maximum page for printing
    By simgs in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 04-28-2013, 02:51 AM
  6. Extract the maximum value and copy the entire row.
    By Faye in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-18-2005, 08:05 PM
  7. Replies: 1
    Last Post: 01-16-2005, 09:30 AM

Tags for this Thread

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