Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to use VBA in Excel to truncate numbers rather than rounding in cells where a formula being applied?

I need to calculate mean and standard deviation of an entered values in a table. But I need the final values to be truncated rather than rounded.[Microsoft 365 for Mac]

I need Excel to show 4 decimal places without rounding them. For example, for 3.88888, I need 3.8888 rather than 3.8889.

For example, I have IFERROR(AVERAGE(A1:A10),"") in cell A11. How can I truncate the average value?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Does anyone know how to do that with VBA?

Thanks

Need to implement VBA to truncate the intermediate calculated data.

>Solution :

Use TRUNC with your existing formula:

=IFERROR(TRUNC(AVERAGE(A1:A10),4),"")
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading