Formula to return a number with a certain amount of decimals

RonOliver

Board Regular
Joined
Aug 30, 2022
Messages
99
Office Version
  1. 365
Platform
  1. Windows
Hi!

299
9.00
9


So A1 is the number of decimals to be displayed. B1 is the number that I want displayed with decimals. Now, my problem is the ROUND function will get rid of the decimals if they are not necessary, the TEXT/CHOOSE functions will do what I want them to do but they will give me the number as a text (and thus, it is impossible for me to work with it further in other mathematical operations), and the VALUE/TEXT/CHOOSE functions will just do what the ROUND function did in the first place.

My question: is there a way for me to display the number in B1 with the amount of decimals specified in A1 even if decimals are not necessary? I want the amount of decimals to be dependent on A1, so if the value changes, the amount of decimals will change too. Can't use VBA, sorry.

Thank you very much!
 
I think something has gone wrong with your reply in post#9 as I can't see anything other than the quote.
😅Sorry I received your email and I was testing your solution. It works perfectly well. Thanks for your time!
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top