+ Reply to Thread
Results 1 to 5 of 5

Number failing ISNUMBER validation

Hybrid View

  1. #1
    Registered User
    Join Date
    09-27-2009
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2003
    Posts
    23

    Number failing ISNUMBER validation

    I have a column of numbers that are failing the ISNUMBER validation because, when copied from a different report, there are three spaces including to the right of the number. So ISNUMBER is returning false until I remove those three spaces. Is there a macro I can build to format these cells correctly, ie remove the extra spaces?

    I've tried using TRIM to no avail...

    NOTE: Sometime is I simply click on the cell and hit enter the validation will go from FALSE to TRUE. I know this has something to do with the import of data, but I can't fix each cell like this, it'll take me hours everyday. I need a way to automate the process.
    Last edited by Phosphonothioic; 02-11-2011 at 04:16 PM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: Number failing ISNUMBER validation

    Try this
    • Select your single-column range of "numbers"
    • Data.Text-to-Columns...Click: Next
    • Make sure "Space" is not checked...Click: Finish

    Does that help?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    09-27-2009
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2003
    Posts
    23

    Re: Number failing ISNUMBER validation

    Quote Originally Posted by Ron Coderre View Post
    Try this
    • Select your single-column range of "numbers"
    • Data.Text-to-Columns...Click: Next
    • Make sure "Space" is not checked...Click: Finish

    Does that help?
    Yes, it works. But it leaves me with the problem of automating the process.

    I've uploaded the file for people to view. I need the macro to pluck all the seven-digit employee ids from sheet2, column B and places them in column A of sheet 1. As it stands, excel does not recognize those IDs as numbers. Your method works, but I have 1000s I need to convert daily. Can a macro do the text to column process?

    Thanks!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-26-2010
    Location
    Seattle Wa
    MS-Off Ver
    Excel 2003
    Posts
    11

    Re: Number failing ISNUMBER validation

    Mod. edit: CODE tags at all times please

    Sub Macro1()
    
        Range("G4").Select 'blank cell
        Selection.Copy
        Columns("C:C").Select 'your nimber range
        Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlAdd, SkipBlanks:= _
            False, Transpose:=False
    End Sub
    You can also do this manually. Copy a blank cell, select the column with your numbers, click paste special add.

    this adds 0 to all your numbers forcing a string to number conversion
    Last edited by DonkeyOte; 02-12-2011 at 04:35 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    08-23-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    328

    Re: Number failing ISNUMBER validation

    You could add an extra line to your existing macro to remove the spaces

    Sub x()
    
    With Sheet2.UsedRange.Columns(2)
    
        .SpecialCells(xlConstants).Replace What:=Chr(32), _
            Replacement:="", _
            LookAt:=xlPart, SearchOrder:=xlByColumns, MatchCase:=True
    
        .SpecialCells(xlCellTypeConstants, xlNumbers).Copy Sheet1.Range("A1")
    
    End With
    
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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