+ Reply to Thread
Results 1 to 15 of 15

Removing commas from the brackets in file

  1. #1
    Registered User
    Join Date
    11-08-2022
    Location
    Lithuania
    MS-Off Ver
    Microsoft Office Home and Business 20212021
    Posts
    15

    Question Removing commas from the brackets in file

    Hello,

    I need to separate it into columns, I want to use commas as delimiters, BUT there are commas between brackets that are ruining it all.
    EXAMPLE: MERCEDES-BENZ SPRINTER 3-t Platform/Chassis (B910, B907) (18-0),
    So the comma after (18-0) is what I would use as delimiter. The comma in (B910, B907) is the comma that ruins everything.
    I been checking this forum thread from 2008 "Remove commas if they are between brackets" (I cannot post links yet), which is quite similar to my problem, I tried to use the VBA that was created for it (the macro formula I think it is) but I cannot launch it, maybe it changed through the time since im using 2021 excel or I dont know what im doing wrong, but it does not work for me.

    So maybe I could have it explained first how to use that vba thingy properly that is provided there cuz searched the internet, tried many things and still no clue what i am doing wrong. I am really unexperienced with macros coding (if it is called like that) and I have no clue why it is not working. I tried, googled, but I just cant get it what im doing wrong.

    To show the problem I am attaching excel worksheet which has few examples, first one I made manually to show how it should be and then next ones are examples which represent how complexed some strings are.
    Thanks.
    Attached Files Attached Files

  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. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,166

    Re: Removing commas from the brackets in file

    You have only given one expected result. Based ONLY on that, you could use this:

    =SUBSTITUTE(A2,"_,","_")

    More expected results are needed.
    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
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Cool Re: Removing commas from the brackets in file

    try Power Query

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-08-2022
    Location
    Lithuania
    MS-Off Ver
    Microsoft Office Home and Business 20212021
    Posts
    15

    Re: Removing commas from the brackets in file

    Expected results are described, its just no commas between brackets, thats all I need so other examples were not filled on purpose to leave space for tryouts, I am quite new in the forums so I might have understood it wrong, sorry for that.

  5. #5
    Valued Forum Contributor
    Join Date
    06-23-2021
    Location
    Romania
    MS-Off Ver
    2021, 365 v 2208
    Posts
    722

    Re: Removing commas from the brackets in file

    For the second row what are your expectations?
    Diana Tanase


    If the solutions offered helped you to solve your problem, then mark the thread as SOLVED (thread tools in the top menu) and you can click on * to add reputation to those who helped you, as a way to say thank you !

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

    Re: Removing commas from the brackets in file

    To be clear, should these commas be removed, as well? Yes or no?

    (SGF, SGM, SGN, SHM, SHN)
    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

  7. #7
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Removing commas from the brackets in file

    try this

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-08-2022
    Location
    Lithuania
    MS-Off Ver
    Microsoft Office Home and Business 20212021
    Posts
    15

    Re: Removing commas from the brackets in file

    I am not sure how it works, how to do it, but it served the purpose, thank you so much <3

  9. #9
    Registered User
    Join Date
    11-08-2022
    Location
    Lithuania
    MS-Off Ver
    Microsoft Office Home and Business 20212021
    Posts
    15

    Re: Removing commas from the brackets in file

    yes, they should. Everything that is between brackets.

  10. #10
    Registered User
    Join Date
    11-08-2022
    Location
    Lithuania
    MS-Off Ver
    Microsoft Office Home and Business 20212021
    Posts
    15

    Re: Removing commas from the brackets in file

    Quote Originally Posted by Softas View Post
    Expected results are described, its just no commas between brackets, thats all I need so other examples were not filled on purpose to leave space for tryouts, I am quite new in the forums so I might have understood it wrong, sorry for that.
    Expected results are described, its just no commas between brackets, thats all I need so other examples were not filled on purpose to leave space for tryouts, I am quite new in the forums so I might have understood it wrong, sorry for that.

  11. #11
    Banned User!
    Join Date
    02-05-2015
    Location
    San Escobar
    MS-Off Ver
    any on PC except 365
    Posts
    12,168

    Re: Removing commas from the brackets in file

    Quote Originally Posted by Softas View Post
    I am not sure how it works, how to do it, but it served the purpose, thank you so much <3
    you can learn more from here: https://learn.microsoft.com/en-us/power-query/

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

    Re: Removing commas from the brackets in file

    If:

    1. You are using a PC, not a Mac,

    2. Your version has TEXTJOIN (it should have...),

    3. This should work, but may require entry as an array formula:

    =LET(r,IFERROR(FILTERXML("<A><B>"&SUBSTITUTE(SUBSTITUTE(A2,"(","</B><B>("),")",")</B><B>")&"</B></A>","//B"),""),TEXTJOIN(" ",,IF(LEFT(r,1)="(",SUBSTITUTE(r,",",""),r)))
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    11-08-2022
    Location
    Lithuania
    MS-Off Ver
    Microsoft Office Home and Business 20212021
    Posts
    15

    Re: Removing commas from the brackets in file

    Quote Originally Posted by Glenn Kennedy View Post
    If:

    1. You are using a PC, not a Mac,

    2. Your version has TEXTJOIN (it should have...),

    3. This should work, but may require entry as an array formula:

    =LET(r,IFERROR(FILTERXML("<A><B>"&SUBSTITUTE(SUBSTITUTE(A2,"(","</B><B>("),")",")</B><B>")&"</B></A>","//B"),""),TEXTJOIN(" ",,IF(LEFT(r,1)="(",SUBSTITUTE(r,",",""),r)))
    This is next level stuff, thank you, it helped, it removed all unnecessary commas. Even the ones that were unnecessary and were not between brackets. Brilliant.

  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 2406
    Posts
    44,398

    Re: Removing commas from the brackets in file

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  15. #15
    Registered User
    Join Date
    11-08-2022
    Location
    Lithuania
    MS-Off Ver
    Microsoft Office Home and Business 20212021
    Posts
    15

    Re: Removing commas from the brackets in file

    Quote Originally Posted by Glenn Kennedy View Post
    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.
    Thank you, added the reputations and will make it solved, have a nice day!

+ 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. [SOLVED] Removing Title brackets), reordering names
    By spooks in forum Excel General
    Replies: 5
    Last Post: 04-28-2022, 04:19 AM
  2. [SOLVED] Remove commas if they are between brackets
    By lukesmith7 in forum Excel General
    Replies: 12
    Last Post: 06-25-2014, 05:18 AM
  3. [SOLVED] Removing brackets from words!
    By JRidge in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-19-2013, 04:43 AM
  4. [SOLVED] Formula to remove brackets, full stops, commas and spaces
    By MikeNificent in forum Excel General
    Replies: 4
    Last Post: 07-27-2012, 12:45 AM
  5. Removing Commas
    By solidsnake5698 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-24-2007, 07:38 PM
  6. Removing brackets
    By Hru48 in forum Excel General
    Replies: 3
    Last Post: 12-18-2006, 04:06 PM
  7. removing commas in csv
    By ziggynorton in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-14-2006, 06:15 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