locked
Display numbers without commas RRS feed

  • Question

  • I need a way to display a numeric column without commas.  We have a list of seven digit ID numbers that I want my users to be able to copy and paste into config files.  I can get rid of the decimal points easily enough, but not the commas.   Has anyone figured out a way to do this yet?
    Thursday, August 21, 2008 6:02 PM

Answers

  • Hi,

    For ID number with fixed-length, I suggest you to use Single line of text column instead of number column.

    If you use Single line of text column, you can easily avoid the commas problem.

     

    Hope the information can be helpful.

    -lambert

     


    Posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, August 25, 2008 9:38 AM
  • If the reason you were using the number column was to stop users from entering say alpha characters and force only the digit characters then the single line of text column would result in you losing this built in validation. (It would also lose the max and min properties of the number column.)

    You could just use XSL in the content query web part or the data form webpart to render the items (and their ID column data) and strip out the comma values. Since XSL allows you to control how the data is presented this would resolve the issue.

    I suggest Lamberts solution, but just for further reference in case some developer needs a workaround or someone else and still requires the number field type.

    Hope this helps,
    Richard Harbridge
    Monday, August 25, 2008 2:52 PM
  • You can create a calculated column that references the column your users input their number into.  For example:

    NumberColumn = Column with numbers entered by users
    TestColumn = Calculated column with an output of single line of text

    Let's say the end users enters 1,234 for the value in your NumberColumn.

    Formula would be: =text([NumberColumn],"0")

    This will convert the number entered into the NumberColumn into a single line of text - removing the numerical formatting.  The end result in this example would be 1234.

    This formula needs to be modified just a little to work with numeric columns that contain decimals.

    =text([NumberColumn],"0.0") would change a value of 1234.25 to 1234.3
    =text([NumberColumn],"0.00") would keep a value of 1234.25 as 1234.25

    - Ben
    Tuesday, August 26, 2008 3:45 PM

All replies

  • Hi,

    For ID number with fixed-length, I suggest you to use Single line of text column instead of number column.

    If you use Single line of text column, you can easily avoid the commas problem.

     

    Hope the information can be helpful.

    -lambert

     


    Posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, August 25, 2008 9:38 AM
  • If the reason you were using the number column was to stop users from entering say alpha characters and force only the digit characters then the single line of text column would result in you losing this built in validation. (It would also lose the max and min properties of the number column.)

    You could just use XSL in the content query web part or the data form webpart to render the items (and their ID column data) and strip out the comma values. Since XSL allows you to control how the data is presented this would resolve the issue.

    I suggest Lamberts solution, but just for further reference in case some developer needs a workaround or someone else and still requires the number field type.

    Hope this helps,
    Richard Harbridge
    Monday, August 25, 2008 2:52 PM
  • You can create a calculated column that references the column your users input their number into.  For example:

    NumberColumn = Column with numbers entered by users
    TestColumn = Calculated column with an output of single line of text

    Let's say the end users enters 1,234 for the value in your NumberColumn.

    Formula would be: =text([NumberColumn],"0")

    This will convert the number entered into the NumberColumn into a single line of text - removing the numerical formatting.  The end result in this example would be 1234.

    This formula needs to be modified just a little to work with numeric columns that contain decimals.

    =text([NumberColumn],"0.0") would change a value of 1234.25 to 1234.3
    =text([NumberColumn],"0.00") would keep a value of 1234.25 as 1234.25

    - Ben
    Tuesday, August 26, 2008 3:45 PM
  • The problem with Formula-Text approach is while entering the data or if we do edit then we need to show the original number field.
    Is there any other alternate soln of fix for this while entering or editing the data.
    Thursday, October 8, 2009 2:15 PM
  • Not sure I understand you Vik.

    In the solution proposed by Ben you still retain the original column which can be modified. When the item is updated it will automatically run another calculation updating the calculated column.

    Could you elaborate more on what it is you are trying to do? Or what is causing the issue?

    Richard Harbridge
    Thursday, October 8, 2009 3:04 PM
  • The reason for NOT using single line of text is SP's inability to properly order numbers from smallest to greatest and vice versa.
    • Proposed as answer by davidlcrooks Tuesday, December 9, 2014 7:35 PM
    Thursday, January 30, 2014 4:28 PM