Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Split Upper / Lower case + concatenate rows

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Rep Power
    0

    Split Upper / Lower case + concatenate rows

    I'm looking for a solution for several issues I have with a copied data set.

    samset.jpg

    The data set is as per column A and B in above screenshot.
    The problem in column A is that it contains the unique ID number but also shows blanks. It's not containing always the same number of blanks until the next ID number.
    (I have approx 4000 ID's in the dataset).

    The problem in Column B is that it contains both upper case and lower case characters. I have found on this forum several ways how to extract those, but my problem is that I need to concatenate all lower cases together. In the end I need 2 seperate columns:
    Column D may contain only the upper case characters from column B and has to concatenate those from multiple cells in the column within the ID range (column A).
    Column E is simular, but here I should concatenate all lower case characters from multiple cells in column B, within the ID range (column A).

    Who would be able to help me with this?

    Thanks !!!

    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://www.youtube.com/@alanelston2330
    https://www.youtube.com/watch?v=yXaYszT11CA&lc=UgxEjo0Di9-9cnl8UnZ4AaABAg.9XYLEH1OwDIA35HNIei0z-
    https://eileenslounge.com/viewtopic.php?p=316154#p316154
    https://www.youtube.com/watch?v=TW3l7PkSPD4&lc=UgwAL_Jrv7yg7WWC8x14AaABAg
    https://teylyn.com/2017/03/21/dollarsigns/#comment-191
    https://eileenslounge.com/viewtopic.php?p=317050#p317050
    https://eileenslounge.com/viewtopic.php?f=27&t=40953&p=316854#p316854
    https://www.eileenslounge.com/viewtopic.php?v=27&t=40953&p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316057#p316057
    https://eileenslounge.com/viewtopic.php?p=316705#p316705
    https://eileenslounge.com/viewtopic.php?p=316704#p316704
    https://eileenslounge.com/viewtopic.php?p=176255#p176255
    https://eileenslounge.com/viewtopic.php?f=27&t=40919&p=316597#p316597
    https://eileenslounge.com/viewtopic.php?p=316412#p316412
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316280#p316280
    https://eileenslounge.com/viewtopic.php?p=315915#p315915
    https://eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315744#p315744
    https://www.eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315680#p315680
    https://eileenslounge.com/viewtopic.php?p=315743#p315743
    https://www.eileenslounge.com/viewtopic.php?p=315326#p315326
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40752
    https://eileenslounge.com/viewtopic.php?p=314950#p314950
    https://www.eileenslounge.com/viewtopic.php?p=314940#p314940
    https://www.eileenslounge.com/viewtopic.php?p=314926#p314926
    https://www.eileenslounge.com/viewtopic.php?p=314920#p314920
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 05-16-2024 at 02:50 PM.

  2. #2
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    12
    Last edited by DocAElstein; 03-01-2024 at 03:04 PM.

  3. #3
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Rep Power
    0
    Quote Originally Posted by p45cal View Post
    see attached.
    super, this looks what I want to see.
    I'm new with this, and run into following issue:
    I copied my real dataset into column A and B and also added an extra number on the bottom.
    Then I change this part of the formula (2 parts) to the last cell number in my dataset. but then I get following error message:

    "You cannot change part of an array"

    how can I solve this?

  4. #4
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    13
    Code:
    Sub M_snb()
        ReDim sp(1 To Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas.Count, 1 To 2)
        y = 1
        
        For Each ar In Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas
            c00 = Join(Application.Transpose(ar.Offset(-1, 1).Resize(ar.Rows.Count + 1)))
            For j = 1 To Len(c00)
               If Mid(c00, j, 1) Like "[a-z]" Then
                    sp(y, 1) = Left(c00, j - 1)
                    sp(y, 2) = Mid(c00, j)
                    y = y + 1
                    Exit For
                End If
            Next
        Next
        
        Cells(20, 4).Resize(UBound(sp), UBound(sp, 2)) = sp
    End Sub

  5. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Rep Power
    0
    Quote Originally Posted by snb View Post
    Code:
    Sub M_snb()
        ReDim sp(1 To Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas.Count, 1 To 2)
        y = 1
        
        For Each ar In Cells(1).CurrentRegion.Columns(1).SpecialCells(4).Areas
            c00 = Join(Application.Transpose(ar.Offset(-1, 1).Resize(ar.Rows.Count + 1)))
            For j = 1 To Len(c00)
               If Mid(c00, j, 1) Like "[a-z]" Then
                    sp(y, 1) = Left(c00, j - 1)
                    sp(y, 2) = Mid(c00, j)
                    y = y + 1
                    Exit For
                End If
            Next
        Next
        
        Cells(20, 4).Resize(UBound(sp), UBound(sp, 2)) = sp
    End Sub
    thanks for the effort, but in my real data set I also have ID's without blank cells below and this code isn't picking those up.

  6. #6
    Member p45cal's Avatar
    Join Date
    Oct 2013
    Posts
    94
    Rep Power
    12
    The arrays are only 2 cells wide. You select the two cells, adjust the formula, then ctrl+shift+Enter to enter the formula into both cells. Then you can copy the pair of cells down.

  7. #7
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Rep Power
    0
    thanks p45cal

    @snb, my appologies, I thought it didn't make a difference.
    apperently seen the other solution, it doesn't.

  8. #8
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    13
    Please do not quote !

    Why didn't you tell so in the first place ?

  9. #9
    Senior Member
    Join Date
    Jun 2012
    Posts
    337
    Rep Power
    13
    It does; but you can only take it into account if the information doesn't lack.

    Code:
    Sub M_snb()
        ReDim sp(1 To Cells(1).CurrentRegion.Columns(1).SpecialCells(2).Count, 1 To 2)
        y = 1
        
        For Each cl In Cells(1).CurrentRegion.Columns(1).Offset(1).SpecialCells(2)
            c00 = cl.Offset(, 1)
            If cl.Offset(1) = "" Then c00 = Join(Application.Transpose(cl.Offset(, 1).Resize(cl.Resize(UBound(sp)).SpecialCells(4).Areas(1).Cells.Count + 1)))
            
            For j = 1 To Len(c00)
               If Mid(c00, j, 1) Like "[a-z]" Then
                    sp(y, 1) = Left(c00, j - 1)
                    sp(y, 2) = Mid(c00, j)
                    y = y + 1
                    Exit For
                End If
            Next
        Next
        
        Cells(20, 4).Resize(UBound(sp), UBound(sp, 2)) = sp
    End Sub
    Last edited by snb; 09-21-2014 at 12:07 AM.

  10. #10
    Junior Member
    Join Date
    Sep 2014
    Posts
    6
    Rep Power
    0
    @SNB got an error running this code. but got the other one working in this thread, so thanks for your efforts!
    @p45cal: thanks! it worked, you saved me a week of work!!!! much appreciated.

Similar Threads

  1. Excel Macro to Split Multiple Columns into rows
    By cali-novice in forum Excel Help
    Replies: 2
    Last Post: 05-16-2014, 12:34 PM
  2. Replies: 6
    Last Post: 04-13-2014, 02:31 AM
  3. Random Time Between Fixed Lower And Upper Limits
    By papabill in forum Excel Help
    Replies: 9
    Last Post: 07-22-2013, 05:01 PM
  4. Replies: 4
    Last Post: 05-01-2013, 09:49 PM
  5. Reverse name in excel with upper case,edit formula
    By shrinivasmj in forum Excel Help
    Replies: 3
    Last Post: 09-11-2012, 01:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •