+ Reply to Thread
Results 1 to 3 of 3

String to number conversion, not simple (for me)

  1. #1
    Registered User
    Join Date
    11-26-2008
    Location
    Philippines
    Posts
    26

    String to number conversion, not simple (for me)

    Hello there,

    I'd need some help.

    I need to convert a string to a number.
    You would say that it is simple, and I can solve the problem using Csng.

    Let me explain the issue:

    the problem is that sometimes I have a string live this

    a) 123.45 => csng gives me 12345
    b) 67.8 => csng gives me 678

    the final aim is to get

    a) 123,45
    b) 67,8

    therefore I can't find an easy solution just dividing it by 10 or 100.
    If dividing by 100 in case a is correct, in case b I would get a wrong number.

    Please, can anybody help me ?

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: String to number conversion, not simple (for me)

    You could try with:
    CSng(Replace("123.45",".",","))
    Regards,
    Antonio

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: String to number conversion, not simple (for me)

    Please Login or Register  to view this content.



+ 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