+ Reply to Thread
Results 1 to 7 of 7

Merging Informatipn for Invoicing

Hybrid View

  1. #1
    Registered User
    Join Date
    03-19-2021
    Location
    Ireland
    MS-Off Ver
    365
    Posts
    12

    Merging Informatipn for Invoicing

    Hi
    Please see the workbook attached.

    Invoicing 2024-25.xlsx

    I run a schools based soccer organisation & we offer competitions across five age groups, which we call Senior, Junior, Ty, Minor & First Year.
    The workbook contains details of all schools that have entered competitions this season, all information is merged onto one sheet.
    The sheet is currently organised by competition & the columns listed show the code of the competition (BSC = Boys Senior Cup, GFYBC = Girls First Year B Cup etc.) & the Yes/No response.

    I need to find a simple way to merge all of this information, so that the sheet shows the following information:

    Column Headings:
    1) School Name
    2) BSC
    3) BSBC
    4) BSL
    5) GSC
    6) GSBC
    7) GJL
    8) BJC
    9) BJBC
    10) BJL
    11) BTYC
    12) GJC
    13) GJBC
    14) GJL
    15) BMC
    16) BMBC
    17) BML
    18) GMC
    19) GMBC
    20) GML
    21) BFYC
    22) BFYBC
    23) BFYL
    24) GFYC
    25) GFYBC
    26) GFYL

    Any takers?

    Thanks

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2507 (Windows 11 Home 24H2 64-bit)
    Posts
    91,790

    Re: Merging Informatipn for Invoicing

    Sorry - I don't follow this.

    A good sample workbook has just 10-20 rows of representative data that has been desensitised. The sample layout accurately matches that of your real data. It also has expected results mocked up, worked examples where required, relevant cells highlighted and a few explanatory notes.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,171

    Re: Merging Informatipn for Invoicing

    Option Explicit
    
    Sub Demo()
    
    Dim i As Long, j As Long, lc As Long, n As Long, col As Long
    Dim txt As String
    Dim ar, arr
    Dim t() As String
    Dim dict As Object
    Dim CompRng As Range
    
    Dim comp(1 To 10) As String, a
    ReDim b(1 To 600) As String
    
    Set CompRng = Sheets("sheet2").Cells(1, 2).Resize(1, 25)
    
    Application.ScreenUpdating = False
    
    
    Set dict = CreateObject("scripting.dictionary")
    
        
          With Sheets("Sheet1")
               .Activate
                ar = [a1].CurrentRegion
                For i = 1 To UBound(ar, 1)
                If ar(i, 1) = "School Name" Then
                    lc = .Cells(i, 1).End(xlToRight).Column
                    For j = 2 To lc
                        comp(j - 1) = ar(i, j)
                    Next j
                    i = i + 1
                End If
                For j = 1 To lc - 1
                    txt = ar(i, 1)
                    If Not dict.Exists(txt) Then
                        n = n + 1
                         dict.Add txt, comp(j) & "|" & ar(i, j + 1)
                    Else
                        If ar(i, j + 1) <> "" Then
                            dict.Item(txt) = dict.Item(txt) & "|" & comp(j) & "|" & ar(i, j + 1)
                        End If
                    End If
                    
                Next j
            Next
        
        End With
    
    
    With Sheets("sheet2")
        For i = 0 To dict.Count - 1
        'Sheets("Sheet3").Cells(i + 1, 1).Resize(1, 2) = Array(dict.Keys()(i), dict.Items()(i))
        .Cells(i + 2, 1) = dict.Keys()(i)
        t = Split(dict.Items()(i), "|")
            For j = 0 To UBound(t, 1) Step 2
                col = Application.Match(t(j), CompRng, 0) + 1
                .Cells(i + 2, col) = t(j + 1)
            Next j
        Next i
    End With
    
    Application.ScreenUpdating = True
    
        
    End Sub
    Attached Files Attached Files
    Last edited by JohnTopley; 10-07-2024 at 08:49 AM.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

  4. #4
    Registered User
    Join Date
    03-19-2021
    Location
    Ireland
    MS-Off Ver
    365
    Posts
    12

    Re: Merging Informatipn for Invoicing

    Thanks for both replies - I was about to put up an edited version when I saw John's reply - thanks.

    However, the macro doesnt fully complete the requirement - I have attached the saved workbook again - if you look at sheet 2, which I have sorted by school name, the school appears more than once - is there another way to add/amedn the macro to merge this information also. There should be ballpark 300 schools in total. Sorry for being pernicity & I am extremely grateful for all help provided so far.

    Thanks
    DInvoicing 2024-25 Macro Version.xlsm

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,171

    Re: Merging Informatipn for Invoicing

    The duplicates are a result of inconsistent naming:

    Alexandra College Milltown
    Alexandra College, Milltown

    Ard Scoil Chiarain Naofa Clara
    Ard Scoil Chiarain Naofa, Clara

    Coláiste Chiarain Leixlip
    Colaiste Chiarain, Leixlip
    Coláiste Chiarain, Leixlip

    St. Peters College Dunboyne
    St. Peter's College Dunboyne

    St. Wolstan's Community College Celbridge
    St. Wolstan's Community School Celbridge

    Are School/College the same ? (several occurrences of this type)


    See attached with data sorted in Sheet2
    Attached Files Attached Files
    Last edited by JohnTopley; 10-09-2024 at 05:31 AM.

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    31,171

    Re: Merging Informatipn for Invoicing

    I have done some "cleaning" but there are still problems:

    Examples....

    Ardscoil na Trinoide Athy
    Ardscoil na Trionoide Athy

    Colaiste Bride Enniscorthy
    Colaiste Briide Enniscorthy

    ETSS Wicklow
    Wicklow ETSS
    Attached Files Attached Files
    Last edited by JohnTopley; 10-09-2024 at 05:58 AM.

+ 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. Excel 2007 : Invoicing
    By Lawrence Yeo in forum Excel General
    Replies: 0
    Last Post: 05-22-2011, 07:21 PM
  2. Invoicing
    By meghanb_87 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2010, 04:29 PM
  3. Invoicing
    By denileigh in forum Excel General
    Replies: 5
    Last Post: 11-17-2009, 06:40 PM
  4. invoicing
    By concretetsunami in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-24-2008, 08:42 AM
  5. need help with invoicing
    By DUN RITE ROOFING in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-26-2006, 12:15 PM
  6. [SOLVED] invoicing
    By ghosty61 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2006, 10:45 AM
  7. RE: invoicing
    By Toppers in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-04-2006, 10:20 AM
  8. Invoicing
    By John in forum Excel General
    Replies: 7
    Last Post: 07-07-2005, 06:05 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