web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Create a new numerical...
Power Automate
Answered

Create a new numerical column in excel with a format of 2 decimal places

(0) ShareShare
ReportReport
Posted on by 3

I have a column in Excel with positive and negative values and I have to create a new column for the positives and another for the negatives. I am using one if and after the action "convert text to number" and after "convert number to text" and I choose the 2 decimal places that I need to present but if I select the thousand separator the PAD write to excel for example this result 10 000.11 but without the thousand separator I get this this wrong result 10000.1 with just 1 decimal place (the generated variable, FormattedNumber, have 2 decimal places in PAD).

Can anyone solve this problem because I need to present the value like this 10000.11?

And after I need to present the negative values in this format 0.00 but when I do the same transformations explained above the value that appears in the variable %FormattedNumber% is 0.00 however in Excel it appears just 0.

Annotation 2023-10-13 234429.png
  • Verified answer
    Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @rk83 

     

    This would happening due to excel format issue, if you try manually in that column where your flow is entering the number, it would reduce the number of decimal places as you are seeing now (like 20.20 to 20.2). So to avoid that we have to make excel column format as 0.00 type . for that run a vbscript which set the column format as numbers with two decimal places. 

     

    So add this sequence of code before your code which you are running 

    Nived_Nambiar_0-1697261532957.png

     

    First we are using two set variable option to set excel file path (first one) and other for setting which column we need to format, here we are specifying the excel column letter like A, B,C instead of column.

    Nived_Nambiar_1-1697261650740.png

     

    Now use run vbscript action to run below vbscript 

     

    Set objExcel = CreateObject("Excel.Application")
    objExcel.Visible = True ' Set this to True if you want to see Excel working
    Set objWorkbook = objExcel.Workbooks.Open("%ExcelFilePath%") ' Replace with the path to your Excel workbook
    objExcel.DisplayAlerts = False
    ' Specify the column letter (e.g., "A") to format
    columnToFormat = "%ExcelColLetter%"
    decimalFormat = "0.00" ' Format to display two decimal places
    
    ' Get the worksheet you want to work with
    Set objWorksheet = objWorkbook.Sheets("Sheet1") ' Replace "Sheet1" with your sheet name
    
    ' Set the format for the entire column
    objWorksheet.Columns(columnToFormat).NumberFormat = decimalFormat
    
    ' Now, you can enter data into the formatted column
    'objWorksheet.Range(columnToFormat & "1").Value = 123.456 ' Example data
    
    ' Close the workbook and save changes
    objWorkbook.Close True
    
    ' Quit Excel
    objExcel.Quit
    
    ' Release object references
    Set objWorksheet = Nothing
    Set objWorkbook = Nothing
    Set objExcel = Nothing
    

     

     

    The variables which we have specified earlier will be passing to this vbscript as u will see in script.

     

    Once script completes execution, then place your current script below of this.

     

    Then it would work, it would be considering the format as 0.00

     

    Hope this helps !

    Thanks & Regards,

    Nived N 🚀

    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel

    🔍 Found my answer helpful? Please consider marking it as the solution!
    Your appreciation keeps me motivated. Thank you! 🙌

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 426

#2
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 308

Last 30 days Overall leaderboard