Consulting

Results 1 to 7 of 7

Thread: Line Break Validation

  1. #1

    Line Break Validation

    Hi All,

    I'd greatly appreciate for the help. I'm trying to validate a cell for line breaks and double-spacing with the below formula, but i couldn't get it to work. =OR(NOT(ISNUMBER(SEARCH(" ",A4)),FIND(CHAR(13),A4,1))))

    Thank you.

  2. #2
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,198
    Location
    How about this for count of line breaks:

    =LEN(A4)-LEN(SUBSTITUTE(A4,CHAR(10),""))

    it might only be: CHAR(13) that's the issue.

    hope this helps
    Last edited by georgiboy; 01-23-2018 at 10:11 AM.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved
    Click here for a guide on how to upload a file with your post

    Excel 365, Version 2403, Build 17425.20146

  3. #3
    Quote Originally Posted by georgiboy View Post
    How about this for count of line breaks:

    =LEN(A4)-LEN(SUBSTITUTE(A4,CHAR(10),""))

    it might only be: CHAR(13) that's the issue.

    hope this helps
    Thank you, Georgiboy. But that is not what i am looking for, because we are not allowed to alter the sheet. We use the spreadsheet to import data into the system. I would prefer to do a cell validation so that it alerts people to fix line breaks or extra spacing between words when they copy/paste into the spreadsheet.

  4. #4
    Figured it out!

  5. #5
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,059
    Location
    Quote Originally Posted by lacviet2005 View Post
    Figured it out!
    Dont you just love it when people wont share the solution.......
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  6. #6
    Quote Originally Posted by Aussiebear View Post
    Dont you just love it when people wont share the solution.......
    🤪 will share tomorrow when I’m back in the office...geez! 😁

  7. #7
    It's been awhile....
    Anyway, not sure if this is helpful, but here's the formula for my line break and double-space validation: =AND(NOT(ISNUMBER(SEARCH(CHAR(13),$A4))),NOT(ISNUMBER(SEARCH(" ",$A4))))

    FYI, I used CHAR(13) because i'm on Mac OS. Cheers!

Posting Permissions

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