Hi,
I have a weird situation here. I've got some data in excel format like below (sample):
| ITEM | QUANTITY | RATE/UNIT |
| ABC | 2 | 97.8 |
| ASD | 13 | 125.2 |
| ZXC | 1 | 294 |
| QWE | 5 | 35.7 |
| POI | 7 | 201 |
| LKJ | 30 | 177.1 |
| MNB | 25 | 208.1 |
| XYZ | 18 | 123.3 |
Also, I've been given the sumtotal value i.e. the total after (QUANTITY x RATE/UNIT) of each item which in this case is 16431.02. But if I do a sumproduct on excel on the given data it gives 16437.60 which is due to the data of column RATE/UNIT being rounded to either 0 or 1 place after decimal place (.) and pasted as value so I cannot know what the two decimal value of the cell should be.
I'm trying to convert the data of column RATE/UNIT to numbers with two decimal places using the available data mentioned above using c#.
Can anybody help me on this ?



Sachin SinghPosted Nov 15, 2021, 7:31 AM
Jayanta MukherjeePosted Nov 15, 2021, 7:18 AM
You're all getting it wrong. In the source excel file the RATE/UNIT column data doesn't have the value after one decimal place, so using Math.Round wouldn't do the job it will simply convert 97.8 to 97.80 and so on. Please check the expected values I mentioned in my 1st reply.
Jignesh KumarPosted Nov 15, 2021, 7:07 AM
Vikas PanwarPosted Nov 15, 2021, 6:09 AM