I have a code which returns numbers with 20 decimals, when I copy them and paste in excel I can't reduce number of decimals, Is there any special way or trick to copy and paste so that I can reduce number of decimals?


Perhaps you can use this approach.

datum = N[Pi, 20]


excelNum = Round[datum, 10^-8] // N;
excelNum // FullForm


  • $\begingroup$ Many thanks, however I knew how to reduce number of decimals using Mathematica code but I wanted to do so without it. $\endgroup$ – Wisdom Jan 1 '20 at 6:59
  • $\begingroup$ @Wisdom. I am not a Mathematica guru, so somebody might post an answer proving me wrong, but I don't think it can be done without running some code on the selected data. You could make pallete with a button that runs a script to apply the code to selected data to make the digit reduction more convenient. $\endgroup$ – m_goldberg Jan 1 '20 at 7:28
  • 2
    $\begingroup$ @Wisdom - If you want to automatically Round all real numbers in output use $Post = # /. x_Real :> Round[x, 10.^-8] & Then use $Post=. to return to normal. But then, why not do this in Excel? You can automate with a VBA macro. $\endgroup$ – Bob Hanlon Jan 1 '20 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.