0

I have a spreadsheet containing both real and complex numbers. Some of them are like

0.48686

while others are like

4.85609+j3.24184

I am trying to round them, in order to have only two decimal places.

While Format > Cells works on the real numbers, it doesn't on the complex ones, because LibreOffice interprets them as a string.

I have looked up in google, but couldn't find anyone with the same problem.

I wanted to know if there was anyone who had already developed a macro for that, before trying to do it myself.

Etheryte
  • 24,589
  • 11
  • 71
  • 116
Anthony
  • 443
  • 1
  • 5
  • 16

1 Answers1

1

You could round the complex number by combining the ROUND() and the COMPLEX() functions:

enter image description here

A3 has the formula

=COMPLEX(A1;A2)

while A4 has

=COMPLEX( ROUND(A1;2) ; ROUND(A2;2) )

(adapting a solution from a german ms office forum to OOo.Calc / LO Calc)

tohuwawohu
  • 13,268
  • 4
  • 42
  • 61
  • 1
    If I'm not mistaken, this modifies the result, not only the result shown, which is generally not wanted. – jcoppens Jun 09 '22 at 16:01