New sheet with MAX cell values from other sheets

rodmorais

New Member
Joined
May 17, 2020
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hello my dear friends, 1st post here..

I have a spreadsheet with several sheets where sheet name is the person's name (1st and last name). I need create a new sheet with consolidated data, where column A already have the person's name, and I need the MAX cell value from columns A-C at each sheet's person.

So for example, I will get the MAX cell value from sheets John Lennon, George Harrison, Paul McCartney columns B-C and populate the new sheet like below:

New Sheet
[Column A]-----------[Column B]------------------------------------[Column C]
John Lennon [max cell value from B at John's sheet]-------[max cell value from C at John's sheet]
George Harrison
Paul McCartney

Thanks in advance!

Cheers from Brazil.
RodMorais
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi,
Welcome to MrExcel :).
Here I've prepared some code for you. First of all add a new worksheet manually in the spreadsheet and name it "Summary". Than copy and paste below code. Once you run it all the max values from columns B and C and sheed names will be gathered from all worksheets and returned to the Summary sheet starting from row 2. Each run of the macro clears the data in the summary tab before importing them from all worksheets.
Check if that what you need and let me know.

VBA Code:
Sub GetMaxOfWorksheets()
    Dim noRow&
    Dim ws As Worksheet
    Dim shtSummary As Worksheet
    Dim str$
    
    Const shtMaster = "Summary"
    Const defCol$ = "A"
    noRow = 1
    
    Set shtSummary = Worksheets(shtMaster)
    
    'Data clearance
    shtSummary.Range("A2:C" & Cells.Rows.Count).ClearContents
    
    For Each ws In Worksheets
        If LCase(ws.Name) <> LCase(shtSummary.Name) Then
            noRow = noRow + 1
            str = "'" & ws.Name & "'!"
            shtSummary.Cells(noRow, defCol) = ws.Name
            shtSummary.Cells(noRow, defCol).Offset(0, 1) = WorksheetFunction.Max(Range(str & "B:B"))
            shtSummary.Cells(noRow, defCol).Offset(0, 2) = WorksheetFunction.Max(Range(str & "C:C"))
        End If
    Next ws
    
    MsgBox "Done", vbInformation, "InfoLog"
    
End Sub
 
Upvote 0
Hey! Thank you very much!! I will definitely try that! Do you think is possible to do it without a script?
 
Upvote 0
Hi,
You're welcome!. You need a list of worksheets and it's max values in column B and C and it's impossible to achieve it using standard functions in excel. For this reason you need a script.
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,164
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top