mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-11 05:43:17 +00:00
Add sample - How to convert abbreviate or shorten long numbers in Excel
This commit is contained in:
23
Examples/CustomNumbers/ShortenNumbers.ps1
Normal file
23
Examples/CustomNumbers/ShortenNumbers.ps1
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# How to convert abbreviate or shorten long numbers in Excel
|
||||||
|
|
||||||
|
Remove-Item .\custom.xlsx -ErrorAction SilentlyContinue
|
||||||
|
|
||||||
|
$data = $(
|
||||||
|
12000
|
||||||
|
1000
|
||||||
|
2000
|
||||||
|
3000
|
||||||
|
2400
|
||||||
|
3600
|
||||||
|
6000
|
||||||
|
13000
|
||||||
|
40000
|
||||||
|
400000
|
||||||
|
1000000
|
||||||
|
)
|
||||||
|
|
||||||
|
$excel = $data | Export-Excel .\custom.xlsx -PassThru
|
||||||
|
|
||||||
|
Set-ExcelRange -Worksheet $excel.Sheet1 -Range "A:A" -NumberFormat '[>999999]#,,"M";#,"K"'
|
||||||
|
|
||||||
|
Close-ExcelPackage $excel -Show
|
||||||
Reference in New Issue
Block a user