+ Reply to Thread
Results 1 to 4 of 4

Comma Then Space After Each Number In Cell

  1. #1
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Comma Then Space After Each Number In Cell

    Hello,

    Is it possible to format a cell to only allow numbers separated by comma then by one space like this:

    125, 2368, 22, 33, 791, 698

    Thank you,
    Fred

  2. #2
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Comma Then Space After Each Number In Cell

    It would be data validation rather than formatting.

    Here's an attempt that will detect non-numeric characters as well as commas without a following space. It's not foolproof - for example it will allow periods, but before we make the formula any more complex, let's see if this is a viable approach for you.

    The formula as it stands (a) strips comma-space sequences and checks that the result is a valid number and (b) because random commas still pass the isnumber() test, a second test checks for any residual commas from the result of (a) and if any exist then the cell contents are declared invalid.

    Assuming the cell that you want to check is A1:
    Select cell A1
    Data > Data Validation > Allow -> "custom"
    Enter the formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    You may also want to set an error alert message: Something like: "Enter only numbers separated by comma-space"

    Hopefully this helps.

  3. #3
    Forum Contributor
    Join Date
    03-12-2019
    Location
    USA
    MS-Off Ver
    2010
    Posts
    421

    Re: Comma Then Space After Each Number In Cell

    Thanks for the reply. I tried the formula in data validation but it doesn't do anything for new entries. I think I might just put a rule attached by comment for that cell.

  4. #4
    Forum Expert
    Join Date
    10-15-2018
    Location
    MA, USA
    MS-Off Ver
    2010, 2019
    Posts
    1,616

    Re: Comma Then Space After Each Number In Cell

    I'm not sure what you mean by "it doesn't do anything for new entries". Take a look at the attached workbook. Try entering invalidly formatted data into cell A2. You will see a popup saying "Bad format".

    Let me know how you get on.
    Attached Files Attached Files

+ 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] Vlookup value after comma+space and add the values till last comma+space in the series
    By sandeepsandeep in forum Excel Formulas & Functions
    Replies: 49
    Last Post: 12-23-2017, 05:49 AM
  2. Replies: 16
    Last Post: 02-21-2017, 02:10 AM
  3. Comma delimited numbers with space after comma
    By Cicada in forum Excel General
    Replies: 5
    Last Post: 04-23-2015, 09:32 AM
  4. [SOLVED] Convert space between first and last name to comma
    By Vaslo in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-04-2014, 03:06 PM
  5. [SOLVED] Replace space to comma
    By rarementality in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2014, 09:15 AM
  6. Replies: 2
    Last Post: 02-02-2012, 12:47 AM
  7. Removing a space after a comma
    By DebbieK9 in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 04-01-2005, 06:06 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