+ Reply to Thread
Results 1 to 7 of 7

cannot convert text to number?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-16-2008
    Location
    iowa
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    63

    cannot convert text to number?

    I have a spreadsheet of data exported from and ACT database - and it has several issues that make it hard/messy.
    One is that it adds an extraneous NL to each field, and another is that it prepends an invalid character (code=63) to numeric's.

    Each of these are fairly easy to correct, bu I end up with some cells that all look empty, but are not formatted as numbers, and I cannot seem to easily convert them.

    I attach an example. The issue is that actual number cells convert fine, and I can then do arithmetic on them.
    But blank cells, do not work well. The result of the cleanup (=mid(clean(A1),2,99) for blanks looks empty, and tests as isText(), but gives a #Value error on trying to convert it .

    So I tried a formula where I would leave blank cells alone, and just try to convert number cells:
    =IF(ISBLANK(C2),,VALUE(MID(C2,2,99)))
    Which converts empty cells (really empty, I manually clear them) to 0 values, and cells that have resulted from a clean+mid but look empty give an error.

    So the basic question is:
    * What is in the apparently empty but not convertable (value) cells like C4 (=C22) (the user named cell "G11" )?
    Note that manually clearing them, then it works to be convertable to a numeric, but gives a zero (instead of blank).
    * How should I be converting these to numerics? (I want to do sums on them).
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,928

    Re: cannot convert text to number?

    How about this?

    =IF(C2="",,VALUE(MID(C2,2,99)))

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,048

    Re: cannot convert text to number?

    Slightly shorter version...
    =IF(C2="","",--MID(C2,2,99))
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    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,662

    Re: cannot convert text to number?

    Since you have O365, do the entire column using:

    =IF(C2:C4="","",--MID(C2:C4,2,99))

    or

    (if the char 63- actually UNICODE 65279 a zero-width non-breaking space- isn't always the first character)

    =IFERROR(SUBSTITUTE(C2:C4,UNICHAR(65279),"")+0,"")
    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

  5. #5
    Registered User
    Join Date
    10-16-2008
    Location
    iowa
    MS-Off Ver
    Microsoft 365 Apps for enterprise
    Posts
    63

    Re: cannot convert text to number?

    Thanks to all, works. A bit mysterious for such a simple thing - "blank" (appearing) cells can have a variety of actual contents.

  6. #6
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: cannot convert text to number?

    Maybe

    =VALUE("0"&TEXTJOIN("",1,IF(LEN("0123456789.-")<>LEN(SUBSTITUTE("0123456789.-",MID(C3,ROW($1:$256),1),"")),MID(C3,ROW($1:$256),1),"")))

    Note : I'm not sure about TEXTJOIN , I'm use Excel 2016.

    Regards.

  7. #7
    Forum Expert
    Join Date
    04-14-2009
    Location
    Taiwan
    MS-Off Ver
    Excel 2016,2019,O365
    Posts
    2,928

    Re: cannot convert text to number?

    You are welcome.
    --------------------------------------
    If that takes care of your original question, please click on "Thread Tools" from the menu link above and mark this thread as SOLVED.

+ 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] Number stored as text error, convert to number script
    By dw_22801 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-30-2023, 06:05 PM
  2. Replies: 5
    Last Post: 11-30-2014, 07:56 AM
  3. [SOLVED] Macro to convert text number to digital number
    By Patish in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-18-2014, 07:43 AM
  4. Replies: 1
    Last Post: 10-28-2012, 05:42 AM
  5. Convert a number formatted as text to a number in a macro
    By MACRE0 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-21-2005, 09:51 PM
  6. [SOLVED] convert text-format number to number in excel 2000%3f
    By Larry in forum Excel General
    Replies: 1
    Last Post: 07-29-2005, 04:05 PM
  7. not able to convert text, or graphic number to regular number in e
    By knutsenk in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-02-2005, 04:14 AM

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