+ Reply to Thread
Results 1 to 22 of 22

Concat big data

  1. #1
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Post Concat big data

    Hi Experts,

    I was wondering if there is an easier way to concat multiple cells based on the below mentioned criteria;

    1. To concat set of two cells from 29 columns, for example DT2=concat(O2,P2), DU2=concat(O2,Q2) and so on..
    2. To concat set of three cells from 29 columns, for example EEET2=concat(O2,P2,Q2), EEEF2=concat(O2,P2,R2) and so on..
    3. To concat set of four cells from 29 columns, for example FFFT2=concat(O2,P2,Q2,R2), FFFU2=concat(O2,P2,Q2,T2) and so on..
    4. To concat set of fife cells from 29 columns, for example SSST2=concat(O2,P2,Q2,R2,S2), SSSU2=concat(O2,P2,Q2,R2,T2) and so on..
    5. To concat set of six cells from 29 columns, for example TTTT2=concat(O2,P2,Q2,R2,S2,T2), TTTU2=concat(O2,P2,Q2,R2,S2,U2) and so on..
    6. And so on until concat set of 29 cells


    I have attaches the file for easy reference.

    As per my calculation it will be 406 columns to concat just set of two cells and to concat all based on the above criteria, it will be more then 5000 columns and it takes a lot of time to do manually, so appreciate if somebody could provide me any solution like a macro or any formula to complete this task easier.;
    Attached Files Attached Files
    Last edited by Gulya; 10-04-2022 at 04:38 AM.

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

    Re: Concat big data

    In DT2 copied across and down:

    =TEXTJOIN(",",,$O2:P2)
    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.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Concat big data

    If the numbers in red across the top from DT1 onwards can be relied upon, then you can use this formula in DT2:

    =INDEX($O2:$AQ2,LEFT(DT$1,FIND(",",DT$1)-1))&","&INDEX($O2:$AQ2,RIGHT(DT$1,LEN(DT$1)-FIND(",",DT$1)))

    You can copy this across (and down) to generate the 2-character combinations. Beyond that, I would need to see examples of what you are trying to achieve.

    It might be better doing this using VBA.

    Hope this helps.

    Pete

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Concat big data

    I see you changed the information in the opening post AFTER I posted - please don't do this.

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Concat big data

    Seen, but no reply ...

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank those who have helped you by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

  6. #6
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Re: Concat big data

    Hi Pete_UK,

    The formula is working perfectly if there is a data in the 1rst row, so can we use a formula even to the header/1st row?.

    Regarding set of three cells, I have included examples in the column TJ2 onwards.

    Appreciate if you could provide either VBA or formula for the remaining set of 3,4,5,6,7......29 cells as well please.

    Thanks
    Attached Files Attached Files

  7. #7
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Concat big data

    This formula, in cell TJ2, works for the next set of numbers that you have in TJ1:VJ1, and can be copied across to VJ2 :

    =INDEX($DT2:$TI2,MATCH(LEFT(TJ$1,3),$DT$1:$TI$1,0))&","&INDEX($O2:$AQ2,SUBSTITUTE(TJ$1,LEFT(TJ$1,4),""))

    although I think it will fail when you start to get 2-digit numbers in the first and second position, because I have hard-coded the 3 and 4 above (in red). It basically works by taking what you have already concatenated (in the range DT2:TI2) and joining on the final part from the range O2:AQ2. The same principle could be applied to all your other concatenations if they are built up systematically as 2-column, 3-column, 4-column etc. up to 29 columns.

    However, I do feel that it is not a problem suitable for a formula solution, but I am not in a position to offer a VBA approach - perhaps someone else will chip in with that.

    Hope this helps.

    Pete

  8. #8
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Re: Concat big data

    Thanks Pete_UK for the effort

    The formula seems okey, but still I need to concat DT1:XFD1 manually because the below provided formulas are working based on DT1:XFD1 data.

    Is there a way to use the below formulas without referring to DT1:XFD1

    =INDEX($O2:$AQ2,LEFT(DT$1,FIND(",",DT$1)-1))&","&INDEX($O2:$AQ2,RIGHT(DT$1,LEN(DT$1)-FIND(",",DT$1)))

    =INDEX($DT2:$TI2,MATCH(LEFT(TJ$1,3),$DT$1:$TI$1,0))&","&INDEX($O2:$AQ2,SUBSTITUTE(TJ$1,LEFT(TJ$1,4),""))

    thanks

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Concat big data

    I'll have a go at generating the number combinations for you, so that they can just be pasted into row 1.

    Pete

  10. #10
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,728

    Re: Concat big data

    Just to be clear, you don't want anything concatenated with itself ?

    Pete

  11. #11
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Re: Concat big data

    There won't be any concatenation with itself like concat(A1,A1), everything will be concatenated with different cells.
    thanks

  12. #12
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Concat big data

    Have I gone invisible?

  13. #13
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198
    Quote Originally Posted by AliGW View Post
    Have I gone invisible?
    Hi Ali,
    I didn?t get you🤔

  14. #14
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Concat big data

    Ali, your solution concatenates everything. That's not what was wanted (I think).

    Try this:

    =IFERROR(TEXTJOIN(",",,INDEX($O2:$AQ2,,FILTERXML("<A><B>"&SUBSTITUTE(DT$1,",","</B><B>")&"</B></A>","//B"))),"")

    copied across. Works for all cells where expected answers are shown.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,869

    Re: Concat big data

    Hi Ali,
    I didn?t get you
    I offered a solution in post #2. You haven't acknowledged it.

    Administrative Note

    ... please don't ignore contributors to your thread - acknowledge all solutions offered, even if they don't meet your requirements. Thanks.

    Ali, your solution concatenates everything. That's not what was wanted (I think).
    It was what I understood was wanted at the time. However, as it was seen hours ago and simply ignored, I suppose I guessed incorrectly.
    Last edited by AliGW; 10-04-2022 at 10:22 AM.

  16. #16
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Re: Concat big data

    well noted Ali.
    As Glenn mentioned =TEXTJOIN(",",,$O2:P2) is concatenating everything. Thanks

  17. #17
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Re: Concat big data

    Hi Glenn,
    Is there a way to use the formulas without referring to DT1:XFD1, otherwise I need to concat the header (DT1:XFD1) again manually in order to use the formula. thanks

  18. #18
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Concat big data

    I was thinking about that earlier... trying to be "smart". However I gave up. I'll take another look either now, or in the morning.

  19. #19
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Concat big data

    I guess it depends on how smart you want the formula to be...

    See the formulae in purple & light blue. To fully automate this would require a bit more (a lot more??) effort. How does this look??

    ="1,"&1+COLUMNS($DT1:DT1)

    and then a variant in the light blue cells.
    Attached Files Attached Files

  20. #20
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Re: Concat big data

    Thanks a lot Glenn, Pete and Ali

  21. #21
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,053

    Re: Concat big data

    I assume you're OK with a semi-automatic workaround, then?

    I hope so... as I'm not sure how to tackle full automation!

  22. #22
    Forum Contributor
    Join Date
    07-17-2020
    Location
    Uzbek
    MS-Off Ver
    Office 365, V 2212
    Posts
    198

    Re: Concat big data

    Hi Glenn,
    Running the below query to generate set of 2 & 3......29 combinations then updating them manually with the following formula =TEXTJOIN(",",,A2,B2)

    Sub HeaderGenerator()

    Const u& = 29
    Const v& = 3
    Const m& = 2 ^ 20
    Dim x&(), a&, b&, c&, k&, r&, sp&
    ReDim x(1 To m, 1 To v)
    sp = v + 10
    For a = 1 To u
    For b = a + 1 To u
    For c = b + 1 To u
    ' For d = c + 1 To u
    k = k + 1
    If k > m Then
    Cells(sp * r + 1).Resize(m, v) = x
    r = r + 1
    k = 1
    ReDim x(1 To m, 1 To v)
    End If
    x(k, 1) = a
    x(k, 2) = b
    ' x(k, 3) = c
    'Next c
    Next b
    Next a

    Cells(sp * r + 1).Resize(k, v) = x

    End Sub

+ 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. Min/Max From Data with Variables & CONCAT
    By Mrneski in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-15-2021, 09:14 PM
  2. [SOLVED] extract last 3 numbers from each concat. value in col. B and add to col. A concat cells
    By therealdees in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-17-2021, 11:02 AM
  3. Concat spilled data
    By aguanigei in forum Excel General
    Replies: 5
    Last Post: 04-20-2020, 10:48 AM
  4. [SOLVED] Use CONCAT to pull data from different places
    By burrjc in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-29-2019, 03:40 PM
  5. Replies: 4
    Last Post: 04-09-2019, 09:28 PM
  6. Concat column data in single cell with Matching ID
    By abhit_kumar in forum Excel General
    Replies: 7
    Last Post: 10-04-2012, 09:01 PM
  7. Concat rows based on duplicate data & delete
    By rdougher in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-22-2012, 10:33 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