Forum Discussion
Sharepoint Online, number column NOT aligned right
- Mar 04, 2020
Yes, you need to replace the formula:
=TEXT([Column],"###,###.00")
This type of modification doesn’t have any impact on the original column
Thanks
Again, many thanks for taking time to help me with my question. I tried it and it is very close. The only missing part is now the thousand separator: Is that possible?
And will I be still able to make number calculations with this type of column?
Cheers
Sinan
Sinan621 - I've stumbled across a cleaner solution to keep the thousands formatting (or any other formatting you have set) - just add .displayValue after @currentField. That returns a formatted string, using the columns format settings.
For example:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "div",
"style": {
"display": "table",
"width": "100%"
},
"children": [
{
"elmType": "div",
"txtContent": "@currentField.displayValue",
"style": {
"display": "table-cell",
"text-align": "right",
"vertical-align": "middle"
}
}
]
}
- Sinan621Feb 04, 2021Copper Contributor
Mike_Honey Thanks for sharing, I have applied you formatting proposal to a number column, then numbers just "disappear", when I remove the formatting the numbers are visible again but not formatted as desired. Maybe this is applicable for "calculated columns" only?
- Mike_HoneyFeb 05, 2021Brass Contributor
Sinan621 - my tests so far are regular number columns, so it can work. Sorry it didn't work for you. .displayValue is mentioned on this page:
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting
If I find out more I'll post back here.
- Hiker10Mar 27, 2021Copper Contributor
I have a calculated column of dollar amounts. In the data type returned from this formula, I've selected currency. How can I have my column, right align, with $ sign, and thousands commas, stay in tact? I have chosen 0 decimal points.
Thank you!