+ Reply to Thread
Results 1 to 5 of 5

Consolidating columns into one summary column

Hybrid View

  1. #1
    Registered User
    Join Date
    07-21-2013
    Location
    london england
    MS-Off Ver
    Microsoft Office 365
    Posts
    98

    Consolidating columns into one summary column

    Hi, I have a table to show several menu options (see spread sheet attached). I would like a way for the summary column I to consolidate all the different columns and give me a summary of the options. I know I could do this using the IF(AND formula but the variables would take me too long to include. Is there a shorter method? I have heard of data consolidation but I don't know what it is and whether I can apply it to this example. Thanks for any help you can give.
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Consolidating columns into one summary column

    You could use a small UDF:
    Public Function Summary(rngMatch As Range, rngHeaders As Range)
    Dim c As Range, s() As String, i As Integer, j As Integer
    j = 0
    For i = 1 To rngMatch.Cells.Count
        If Not rngMatch.Cells(i).Value = "" Then
            ReDim Preserve s(j)
            s(j) = Left(rngHeaders.Cells(i).Value, 1)
            j = j + 1
        End If
    Next i
    Summary = Join(s, ",")
    End Function
    Use as:
    I
    1
    SUMMARY
    2
    =summary($B2:$H2,$B$1:$H$1)
    3
    =summary($B3:$H3,$B$1:$H$1)
    4
    =summary($B4:$H4,$B$1:$H$1)
    5
    =summary($B5:$H5,$B$1:$H$1)
    6
    =summary($B6:$H6,$B$1:$H$1)
    7
    =summary($B7:$H7,$B$1:$H$1)
    8
    =summary($B8:$H8,$B$1:$H$1)
    9
    =summary($B9:$H9,$B$1:$H$1)
    10
    =summary($B10:$H10,$B$1:$H$1)
    11
    =summary($B11:$H11,$B$1:$H$1)
    12
    =summary($B12:$H12,$B$1:$H$1)


    which returns:
    I
    1
    SUMMARY
    2
    E,H,B
    3
    C,H,S
    4
    C,L,T
    5
    E,H,B
    6
    E,C,L,T
    7
    C,S,B
    8
    E,L,B,T
    9
    E,S,B
    10
    C,L,S,T
    11
    C,L
    12
    H,S
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Consolidating columns into one summary column

    Hi,

    Here's another approach which doesn't use macros.
    Attached Files Attached Files
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    07-21-2013
    Location
    london england
    MS-Off Ver
    Microsoft Office 365
    Posts
    98

    Re: Consolidating columns into one summary column

    Thanks Olly,
    I am not familiar with how to do this. Can you show me how to do this on my worksheet? Thanks!

  5. #5
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Consolidating columns into one summary column

    How to install your UDF code
    1. Copy the Excel VBA code as posted in post #2
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    You can then use the SUMMARY formula anywhere in this workbook:
    Formula: copy to clipboard
    =summary($B2:$H2,$B$1:$H$1)


    The formula will check all cells in the first specified range (rngMatch), and for each non-blank cell will return the first characters of the matching cells in the second specified range (rngHeaders).

+ 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. Replies: 1
    Last Post: 01-15-2014, 12:47 PM
  2. Consolidating data from certain sheets in a master summary sheet
    By RoyLittle0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-09-2013, 04:41 AM
  3. Summary - Copy the columns based on column headers
    By rafiomeon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2012, 10:32 AM
  4. Consolidating data on summary sheet based on unique ID
    By Evetsthegreat in forum Excel General
    Replies: 1
    Last Post: 06-24-2011, 04:15 AM
  5. Consolidating Multiple Worksheets in One Summary Sheet
    By akh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2010, 02:19 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