+ Reply to Thread
Results 1 to 11 of 11

collate results from a different excel file

Hybrid View

  1. #1
    Registered User
    Join Date
    05-11-2019
    Location
    Leicester, England
    MS-Off Ver
    Office 365
    Posts
    52

    collate results from a different excel file

    I have a master excel file that we use daily, I would like to be able to get some information from that file into another.

    I have attached 2 files, one is the master file, the other is the results file that I would like to get the information on.


    I have done something similar with all the information in one document but im now stuck on how to get it all from another document. I have written text boxes in the results fie to explain what I would like the results to be and included an example for one of them.

    I hope this can be done I cant figure it out so thought it would be a great challenge for somebody.

    Thank you in advance
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: collate results from a different excel file

    I don't see why you want this in a separate spreadsheet. In order to be interactive, all the data and supporting sheets need to be there. We could hide the sheets you don't need to see.

    This application uses Excel Tales (because they know how big they are, so when you add new data, all you need to do is refresh the pivot table) and pivot tables and overlaying some pivot table results with named dynamic ranges.

    I had a question about the YTD. I assumed it is for the group selected where the item is not completed.

    If this is what you are looking for and you need an explanation, give me a shout.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    05-11-2019
    Location
    Leicester, England
    MS-Off Ver
    Office 365
    Posts
    52

    Re: collate results from a different excel file

    looks good but unfortunately they have to be separate files

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: collate results from a different excel file

    OK, I can copy it all to a separate file and hide those sheets you don't need to see. I'll get on it tomorrow.

  5. #5
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: collate results from a different excel file

    Quote Originally Posted by dflak View Post
    OK, I can copy it all to a separate file and hide those sheets you don't need to see. I'll get on it tomorrow.
    Why not create a copy of the Master sheet in the Report workbook using Get & Transform. That would be updated each time you open the Reports workbook. And no need to have the Master file opened.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  6. #6
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: collate results from a different excel file

    Quote Originally Posted by Tsjallie View Post
    Why not create a copy of the Master sheet in the Report workbook using Get & Transform. That would be updated each time you open the Reports workbook. And no need to have the Master file opened.
    Wouldn't this require that the Master Workbook be present? What would happen if the report were mailed off to someone else?

  7. #7
    Registered User
    Join Date
    05-11-2019
    Location
    Leicester, England
    MS-Off Ver
    Office 365
    Posts
    52

    Re: collate results from a different excel file

    that would be fantastic if you can, thank you

  8. #8
    Registered User
    Join Date
    05-11-2019
    Location
    Leicester, England
    MS-Off Ver
    Office 365
    Posts
    52

    Re: collate results from a different excel file

    that's sounds like a great idea if it will work easier that way

  9. #9
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: collate results from a different excel file

    Should you decide to go with the complete copy, here it is.

    There is a control panel sheet that calculates what the Report file name should look like. Fill in the name of the report in Cell B3 and the program will produce a report with that name with a date stamp.
    Attached Files Attached Files

  10. #10
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: collate results from a different excel file

    See if this works...
    Sub Results()
        Const WEEK_NUMBER As String = "E3"
        Const GROUP_NUMBER As String = "H3"
        Const AREA_START As String = "B9"
        
        Dim wbResults As Workbook, wbMaster As Workbook
        Dim rData As Range
        Dim s As String, d As String, dd As String
        Dim v As Variant, vID As Variant
        Dim x As Long, g As Long, y As Long
        
        On Error Resume Next
        Set wbMaster = Workbooks("Master Tracker.xlsx")
        On Error GoTo 0
        If wbMaster Is Nothing Then
            MsgBox "The Master Tracker workbook is not open." & vbNewLine & vbNewLine & "Open file and try again.", vbExclamation, "Needed Workbook isn't Open"
            Exit Sub
        End If
        Set wbResults = ThisWorkbook
        If wbResults.Worksheets("Managers").Range(GROUP_NUMBER).Value2 = "" Then
            
            'get group numbers
            s = UniqueList("Group", g)
            With wbResults.Worksheets("Managers").Range(GROUP_NUMBER).Validation
                .Delete
                .Add Type:=xlValidateList, Formula1:=s
            End With
            MsgBox "Select a Group Number and try again.", vbExclamation, "Group Number Missing"
            Exit Sub
        End If
        wbResults.Worksheets("Managers").Range("b10:h100").ClearContents
        g = wbResults.Worksheets("Managers").Range(GROUP_NUMBER).Value2
        
        'get current week number
        v = wbResults.Worksheets("Settings").Range("a1").CurrentRegion
        For x = 2 To UBound(v)
            If v(x, 2) <= Date And v(x, 3) >= Date Then
                wbResults.Worksheets("Managers").Range(WEEK_NUMBER) = Mid(v(x, 1), 6)
                Exit For
            End If
        Next x
        
        'get areas
        s = UniqueList("Area", g)
        v = Split(s, ",")
        With wbResults.Worksheets("Managers").Range(AREA_START)
            For x = 0 To UBound(v)
                .Offset(x + 1) = v(x)
            Next x
        End With
        
        'get IDs
        s = UniqueList("ID", g)
        v = Split(s, ",")
        With wbResults.Worksheets("Managers").Range(AREA_START)
            For x = 0 To UBound(v)
                .Offset(x + 1, 1) = v(x)
            Next x
        End With
        vID = v
        
        'get less then 7 days
        Set rData = wbMaster.Worksheets("Sheet1").Range("a1").CurrentRegion
        s = ""
        With rData
            For x = 0 To UBound(v)
                d = ">=" & Date - 7
                s = s & WorksheetFunction.CountIfs( _
                .Columns("B"), vID(x), _
                .Columns("C"), g, _
                .Columns("G"), d, _
                .Columns("O"), "<> Complete") _
                & ","
            Next x
        End With
        s = Left(s, Len(s) - 1)
        v = Split(s, ",")
        With wbResults.Worksheets("Managers").Range(AREA_START)
            For x = 0 To UBound(v)
                .Offset(x + 1, 2) = v(x)
            Next x
        End With
        
        'get 7-14 days
        Set rData = wbMaster.Worksheets("Sheet1").Range("a1").CurrentRegion
        s = ""
        With rData
            For x = 0 To UBound(v)
                '=COUNTIFS(range,">="&date1,range,"<="&date2)
                d = ">=" & (Date - 14)
                dd = "<" & (Date - 7)
                s = s & WorksheetFunction.CountIfs( _
                .Columns("B"), vID(x), _
                .Columns("C"), g, _
                .Columns("G"), d, _
                .Columns("G"), dd, _
                .Columns("O"), "<> Complete") _
                & ","
            Next x
    3    End With
        s = Left(s, Len(s) - 1)
        v = Split(s, ",")
        With wbResults.Worksheets("Managers").Range(AREA_START)
            For x = 0 To UBound(v)
                .Offset(x + 1, 4) = v(x)
            Next x
        End With
        
        'get 15 or more days
        Set rData = wbMaster.Worksheets("Sheet1").Range("a1").CurrentRegion
        s = ""
        With rData
            For x = 0 To UBound(v)
                d = ">=" & Date - 365
                dd = "<" & Date - 14
                s = s & WorksheetFunction.CountIfs( _
                .Columns("B"), vID(x), _
                .Columns("C"), g, _
                .Columns("G"), d, _
                .Columns("G"), dd, _
                .Columns("O"), "<> Complete") _
                & ","
            Next x
        End With
        s = Left(s, Len(s) - 1)
        v = Split(s, ",")
        With wbResults.Worksheets("Managers").Range(AREA_START)
            For x = 0 To UBound(v)
                .Offset(x + 1, 6) = v(x)
            Next x
        End With
    End Sub
    Function UniqueList(sColumn As String, lGroup As Long) As String
        Dim ws As Worksheet, rData As Range, c As Range
        Dim lCol As Long, x As Long, coll As New Collection
        
        Set ws = Workbooks("Master Tracker.xlsx").Worksheets("Sheet1")
        lCol = ws.Rows(1).Find(sColumn).Column
        Set rData = Intersect(ws.Range("a1").CurrentRegion, ws.Columns(lCol)).Offset(1)
        On Error Resume Next
        For Each c In rData
            If sColumn = "Group" Then
                If Not IsEmpty(c) Then coll.Add c.Value, CStr(c.Value)
            Else
                If Not IsEmpty(c) And ws.Cells(c.Row, 3) = lGroup Then coll.Add c.Value, CStr(c.Value)
            End If
        Next
        On Error GoTo 0
        If sColumn = "Group" Then QuickSort coll, 1, coll.Count
        For x = 1 To coll.Count
            UniqueList = UniqueList & coll(x) & ","
        Next x
        UniqueList = Left(UniqueList, Len(UniqueList) - 1)
    End Function
    Sub QuickSort(coll As Collection, first As Long, last As Long)
        Dim vCentreVal As Variant, vTemp As Variant
        Dim lTempLow As Long
        Dim lTempHi As Long
        
        lTempLow = first
        lTempHi = last
        vCentreVal = coll((first + last) \ 2)
        Do While lTempLow <= lTempHi
            Do While coll(lTempLow) < vCentreVal And lTempLow < last
                lTempLow = lTempLow + 1
            Loop
            Do While vCentreVal < coll(lTempHi) And lTempHi > first
                lTempHi = lTempHi - 1
            Loop
            If lTempLow <= lTempHi Then
                ' Swap values
                vTemp = coll(lTempLow)
                coll.Add coll(lTempHi), After:=lTempLow
                coll.Remove lTempLow
                coll.Add vTemp, Before:=lTempHi
                coll.Remove lTempHi + 1
                ' Move to next positions
                lTempLow = lTempLow + 1
                lTempHi = lTempHi - 1
            End If
        Loop
        If first < lTempHi Then QuickSort coll, first, lTempHi
        If lTempLow < last Then QuickSort coll, lTempLow, last
    End Sub

  11. #11
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: collate results from a different excel file

    Here's the option with the connection to the Master workbook. No vba needed.
    Condition is that the Master workbook must be accessible by the user user the Report workbook (read-only access will do).
    If you would be mailing the Report then refresh it before mailing it.
    Just change the path to the Master workbook (top-left of the Manager sheet) to yr needs.
    Attached Files Attached Files

+ 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. Collate results over range, and different criteria
    By iantix in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-13-2017, 10:54 AM
  2. How do I collate questionnaire results into a pivot table
    By DawnMad in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 03-22-2015, 09:11 AM
  3. Holidays 2015 - how to collate data in excel file
    By Ranjit Magar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-19-2014, 08:58 AM
  4. Replies: 1
    Last Post: 07-15-2013, 07:24 AM
  5. How to collate all results thru formula.
    By patrickargao in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-02-2013, 12:02 PM
  6. [SOLVED] Collate all tabs in a single file
    By fatalcore in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-22-2012, 07:22 AM
  7. Collate data to a single file
    By fatalcore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-03-2012, 11:22 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