+ Reply to Thread
Results 1 to 2 of 2

number-comma-number formatting problem. Thousands, and string

  1. #1
    Forum Contributor
    Join Date
    04-02-2017
    Location
    Australia
    MS-Off Ver
    2016
    Posts
    403

    Cool number-comma-number formatting problem. Thousands, and string

    Hi Guys,

    I have imported a column of data into excel from MSProject and I want to add a particular integer to each cell.
    I'll jump straight into my example, and bold the error.


    eg: Add 5 to all cells.
    Original data example (each line is a cell):
    3
    12FF+3 days
    7SF+1 wk,68
    5FS+23 days,7FS+23 days,6FS+23 days
    52,97+1 day,9
    2,109
    12,890

    The result should be:
    8
    17FF+3 days
    12SF+1 wk,68
    10FS+23 days,12FS+23 days,11FS+23 days
    57,102+1 day,14
    7,114
    17,895


    However
    2,109 becomes 2114
    12,890 becomes 12895
    which are wrong

    Excel is reading "2,109" as a number and not a string. And excel is also removing the "," from the cell. My macro uses commas to determine which numbers to add. Is there any way to prevent excel from automatically removing this comma?

    Thanks,
    Jimmy

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,419

    Re: number-comma-number formatting problem. Thousands, and string

    You could try looking at the .Text property of the cell rather than the .Value property. The .Value property is returning what Excel sees as the numeric value of the cell; it will not consider it to contain two or more numeric values separated by comma(s)
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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. Replies: 9
    Last Post: 04-09-2018, 09:46 PM
  2. Number formatting | Thousands to ones
    By vjharry in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 12-11-2015, 09:32 AM
  3. VBA number formatting, thousands separator, no decismals
    By bsapaka in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-11-2014, 12:31 PM
  4. function for number formatting, thousands separator, no decimals
    By bsapaka in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2014, 10:36 AM
  5. Currency / number formatting (thousands / millions)
    By konradz in forum Excel General
    Replies: 2
    Last Post: 08-06-2013, 04:23 AM
  6. Syntax for formatting a number with a comma for thousands
    By HangMan in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-30-2013, 06:01 PM
  7. [SOLVED] Need a Macro / VBA to find numbers in a text string and add a thousands comma
    By chicolocal in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-27-2012, 03:12 PM

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