Question about number format

hello,
I have a spreadsheet with currency values. When I assign it to string, the output does not include the dollar sign or comma. However, I also need the output to show numbers only, not the decimal point.

example 82019.79 need output to be: 8201979

I have searched the forum, but maybe missing something.

Thanks
M

Try this .

  1. Take if activity and check condition if strVar.contains(".")
  2. in true part , Assign
    strVar = strVar.replace(".","")

Thanks! for values that do not have cents, I need to output the zeros without the decimal. Right now, if the value does not have cents, it only outputs the numbers before the decimal. is there one statement that could handle both?

1200.00 output: 1200; need output to be 120000

If it correctly recognizes the values as numbers (which seems to be the case), you could multiply by 100.
Int64 finalvalue = CLng(CDbl(readValue)*100)

Using int64 here for safety, if your numbers are small enough standard Int32 will suffice as well.
You can use Convert.ToInt64 and Convert.ToDouble respectively instead of shorthand forms as well.

As a side question - are you sure you want the value increased?

1 Like

Thanks for that. I am about to see how it goes.

I do need the numbers increased because in the system they are being typed into, it automatically recognizes the last 2 numbers as the cents.

1 Like

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