# How to have a rounding to 2 digits after the decimal point in excel

I tried this method but i have an issue

@Soudios - if you are reading that value as string and you want to keep that as is, try that first oneâ€¦if you are reading as string and use it as double value then use the secondâ€¦

1 Like

@prasath17

What i need is to change the numbers on colum â€śCâ€ť in Excel file to 2 decimal
You method is working with all the colum ?

But you didnâ€™t show any numbers as of nowâ€¦

Yes. when you loop it and you can apply for all the column valuesâ€¦

1 Like

Thatâ€™s why i have read column activity and after i use format value

@Soudios - Personally, I havenâ€™t tried that activity.

I would read the sheet and convert the column value either For each or Using Linq and write it backâ€¦this is my approachâ€¦

1 Like

@prasath17
can u send me your approch plz (sample)

@Soudios - This is what I was thinkingâ€¦

Here Row(2) is my Column 2 valuesâ€¦

Then Outside the loop use the write range to write the results back to the sheet.

Hope this helpsâ€¦

1 Like

@prasath17
it will not takes a lot of time ? because il have 200.000 rows on my excel file

Then you need LINQ query for thatâ€¦Give me few minsâ€¦

Going forward, please put that in your requirement clearly so that it would take help us.

1 Like

@Soudios - Here you goâ€¦

Invoke Code

``````dt.AsEnumerable().ToList().ForEach(Sub(row) row(2)= Math.round(cdbl(row(2)),2))
``````

Invoke Code Arguments

As I said before, use write range to write to your results after that.

1 Like

Itâ€™s not better to use read column or it will execute that for all the excel ?

It will update all the column c values. Before asking the question first please try the solution and see what it is doing

1 Like

See my screenshot again.

1 Like

@prasath17

Perfect it works !!! Thank you

But can u explain me how the bot focus on column â€śCâ€ť, i want to know if i will use it next time plz

@Soudios - row(0)= A
Row(1)= B
Row(2)= Câ€¦So instead of giving Row(â€śColumnNameâ€ť)â€¦I used Row(2), thatâ€™s allâ€¦

Once you done with your testing, please mark my post as solution as it help othersâ€¦Thanksâ€¦

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.