Rounding Data from 'Read Cell' Excel Tool

I am trying to pull data from specific cells in excel and update bookmarks in a word document. I am able to perform the entire process but the number actually being put into the word doc is the full number down to 4 decimal places and I only want 2 decimal places. I have tried the simple math.round function but it is not working.

Hi there,

Could you substring the result? If it always has the same length you will be able to do it, but if not you wont.

If not, you can split the result with “,” and the array(1) will be the decimal part. Then you can substring your decimal part to get just your 2 first numbers. After that you will have to link the first part of the array with the second (now substringed), like: array(0).tostring+array(1).tostring <— This is substringed with just 2 decimal numbers.

Regards,
Pablo

1 Like

I tried trim but kept getting errors on syntax. So I am reading a cell from an excel doc and naming it F2_1. It is a GenericValue type. What would my substring forumla look like to get just the two decimal places?

Suposse your variable is aux:

aux.Substring(0,2) for example. This syntax means: in position 0, take the next 2 chars in the string.

aux.Substring(5,3) for example. This syntax means: in position 5, take the next 3 chars in the string.

Hope it helps, if you cant do it I will send you an screenshot but Im sure you will :slight_smile:

Bests,
Pablo

1 Like