How to read value after formatting instead of underlying value

Hi,

I need to read some values from an Excel file to paste them into an application.
Often, the underlying value has 5 decimal places while the formatted cell (and the application) take 4.
It now reads the underlying, 5 decimal-values and simply cuts it off at 4 when pasting in the app.
What I need from the bot is it reading the rounded 4 decimal value from the cell. (Just like it would when copy pasting manually).

Hi,

Can you try the following expression?

Math.Round(yourValue,4,MidpointRounding.AwayFromZero)

Regards,

How would I use that with a read range activity?
What I have now is:
Read Range (range includes doubles and date types)
For Each Row with and Assign with
TestString = TestString + row.item(0).ToString+ vbNewLine

Set to Clipboard activity for TestString

This I can then paste in my application

Dear BoBro,

Just format the value and assign it to the field in app like:

Lets say column B has decimal place upto 5 places
Math.Round(Convert.ToDecimal(row.Item(1).ToString),4)

Thanks,
Geetishree Rao

Hi,

It should be the following.

TestString = TestString + Math.Round(Double.Parse(row.item(0).ToString),4,MidpointRounding.AwayFromZero).ToString+ vbNewLine

Regards,

This worked combined with an if statement checking if the input is indeed of double type (not all are). Thanks for the help :slight_smile:

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