+ Reply to Thread
Results 1 to 24 of 24

how to eliminate commas at start of cell text?

Hybrid View

  1. #1
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    how to eliminate commas at start of cell text?

    novice has columns with ~140K rows
    keywords & phrases for photos in each cell,

    e.g. ,word1 word2,word3 word4 word5 word6,word7 word8 word9, etc.

    ,word1 & word2, is a phrase surrounded by commas, no space needed after commas,
    ,word7 word8 word9, is also a phrase, e.g., New York City
    (phrases strengthen ranking power of keywords)

    characters per cell is limited, so eliminating unneeded characters an advantage;
    commas at start of cell are unneeded, is there formula or steps to eliminate just those commas?

    to make
    ,word1 word2,word3 word4 word5 word6,word7 word8 word9,
    into
    word1 word2,word3 word4 word5 word6,word7 word8 word9, ??

    Thanks in advance. regards jg
    Last edited by ribjig; 08-25-2021 at 01:05 PM.

  2. #2
    Registered User
    Join Date
    11-27-2020
    Location
    India
    MS-Off Ver
    365
    Posts
    53

    Re: how to eliminate commas at start of cell text?

    For the value in cell A2

    Try
    =SUBSTITUTE(A1,",","",1)

  3. #3
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    Re: how to eliminate commas at start of cell text?

    Thanks! Will try.

    =SUBSTITUTE(I2,",","",1) worked!!
    Last edited by ribjig; 08-25-2021 at 01:46 PM.

  4. #4
    Registered User
    Join Date
    11-27-2020
    Location
    India
    MS-Off Ver
    365
    Posts
    53

    Re: how to eliminate commas at start of cell text?

    It would create problem if you don't have comma at starting of cell text
    so to be on safe side

    Try

    =IF(LEFT(I2,1)=",",SUBSTITUTE(I2,",","",1),I2)

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,507

    Re: how to eliminate commas at start of cell text?

    Try:
    Formula: copy to clipboard
    =IF(LEFT(A2,1)<>",", A2, RIGHT(A2, LEN(A2)-1))
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,507

    Re: how to eliminate commas at start of cell text?

    See post #3

  7. #7
    Registered User
    Join Date
    11-27-2020
    Location
    India
    MS-Off Ver
    365
    Posts
    53

    Re: how to eliminate commas at start of cell text?

    Yes, after looking at your formula, I have changed mine

  8. #8
    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
    30,912

    Re: how to eliminate commas at start of cell text?

    No need to change as your original will work if there is no comma.

  9. #9
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    Re: how to eliminate commas at start of cell text?

    Yikes.
    Most cells don't have commas first.
    First space got eliminated in those cases.
    ChinaShanghai
    SpainBarcelona
    etc.
    Unfortunately before discovering, I saved & closed.
    Have backup copy dated Aug 19 but missing several unrelated changes made since.
    Tried to find earlier version of today's copy via File>Info>ManageWorkbook
    but nothing showed from before saving & closing...?

  10. #10
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,507

    Re: how to eliminate commas at start of cell text?

    Unfortunately, we cannot help you recover your file. Lesson to be learned! Always test changes, particularly global changes, on a copy of the file

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,507

    Re: how to eliminate commas at start of cell text?

    @John: no, the formula in post #2, and the amended version in post #4, will replace the first occurrence of the comma, even if it is not the first character. Looks like, in a lot of cases, it will combine two countries/cities.

    The formula in post #3 tested for the scenario but was not used.

  12. #12
    Registered User
    Join Date
    11-27-2020
    Location
    India
    MS-Off Ver
    365
    Posts
    53

    Re: how to eliminate commas at start of cell text?

    Just for my knowledge
    Is there any problem with formula in post #5?

  13. #13
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    Re: how to eliminate commas at start of cell text?

    When I am ready to retry...
    =IF(LEFT(A2,1)<>",", A2, RIGHT(A2, LEN(A2)-1))
    will eliminate cell first character only if comma
    will not make any other changes to cell first characters or other cell characters
    TIA

  14. #14
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,507

    Re: how to eliminate commas at start of cell text?

    The formula checks to see if the formula is a comma; if not, it uses the whole of the cell value. If it is a comma, it takes the right-most characters in the cell.

    Did you copy and paste values over the original cells before you saved and closed the file?

  15. #15
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    Re: how to eliminate commas at start of cell text?

    No, unfortunately.
    Inserted new column right of target column.
    Dragged faulty formula to bottom new column.
    Copied & Special Pasted Values new column over old column.
    Saw that leading commas had disappeared.
    Didn't think to look for rows without leading comma.
    Saved & deleted new column.
    Saved doc & closed.

  16. #16
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,507

    Re: how to eliminate commas at start of cell text?


  17. #17
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    Re: how to eliminate commas at start of cell text?

    I am now using
    =IF(LEFT(I2,1)<>",", I2, RIGHT(I2, LEN(I2)-1))
    when there is nothing in target cell
    this formula responds with a 0
    is there way it could be modified to respond with nothing?
    Thanks in advance

  18. #18
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,159

    Re: how to eliminate commas at start of cell text?

    A simple modification:

    =IF(I2="","",IF(LEFT(I2,1)<>",", I2, RIGHT(I2, LEN(I2)-1)))
    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.

  19. #19
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    Re: how to eliminate commas at start of cell text?

    Thanks but now the target cell that does have
    text with comma first character is also showing
    as nothing in formula cell & Special Paste Values
    as nothing in target cell

  20. #20
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,159

    Re: how to eliminate commas at start of cell text?

    OK - without a sample workbook showing these issues, I have no chance of working it all out, sorry.

  21. #21
    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. 2505 (Windows 11 Home 24H2 64-bit)
    Posts
    91,159

    Re: how to eliminate commas at start of cell text?

    Syntactically, no.

  22. #22
    Registered User
    Join Date
    11-27-2020
    Location
    India
    MS-Off Ver
    365
    Posts
    53

    Re: how to eliminate commas at start of cell text?

    Ok thanks!

  23. #23
    Registered User
    Join Date
    06-23-2021
    Location
    Miami Beach
    MS-Off Ver
    10
    Posts
    17

    Re: how to eliminate commas at start of cell text?

    =IF(LEFT(I2,1)=",",SUBSTITUTE(I2,",","",1),I2)
    produces a 0 in formula cell if there is nothing
    in target cell

    I think I have solution
    in target cells with nothing, replace nothing with nonsense word qwerty
    then after using formula to eliminate unwanted comma first character
    in target cells with text, replace qwerty in target cells with nothing...?

  24. #24
    Registered User
    Join Date
    11-27-2020
    Location
    India
    MS-Off Ver
    365
    Posts
    53

    Re: how to eliminate commas at start of cell text?

    Formula in post #17 should work

    You can also try

    =IF(ISBLANK(I2),"",IF(LEFT(I2,1)=",",SUBSTITUTE(I2,",","",1),I2))

+ 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. VBA Code to Eliminate Trailing Commas in CSV File
    By rjj920 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-30-2021, 11:06 AM
  2. Eliminate Using Text Box to filter data, Just type in Cell
    By wherdzik in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2021, 07:49 PM
  3. Remove numerous trailing commas from text string that contains commas
    By JenSven1 in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2016, 10:19 PM
  4. Replies: 1
    Last Post: 05-23-2016, 11:05 AM
  5. Replies: 5
    Last Post: 01-17-2014, 05:56 PM
  6. Separate Text in A Single Cell & Count and Eliminate Duplicates
    By cuclay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-28-2011, 10:31 PM
  7. Replies: 2
    Last Post: 07-05-2005, 05:05 PM

Tags for this Thread

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