Fit number to the cell

PJFry

New Member
Joined
Feb 9, 2018
Messages
6
I have an issue with fitting a number within cell.
i have 3 digit number, and it is within a cell with width bigger than for 7 digits. I want to spread these 7 digits so that, there are even spacing withing these digits, in other words fit digits to the cell. i do not want to split or put spaces among them, I want to keep them as number within one cell, just to make them look prettier. Later I will use this number for calculation. Increasing font size is not an option, because it increases height of the cell.
Regards
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Hi PJ,

Sorry but it is hard to envisage what you want.

How could you have the 3 digit number "spread" inside a field big enough for 7 digits with "even spacing" but you
do not want to split or put spaces between them ?

First option, you could just use centering format but presumably you don't want that.

So, assuming the best I can that you mean you want it to look something like this :
[TABLE="class: grid, width: 150, align: left"]
<tbody>[TR]
[TD]1[/TD]
[/TR]
[TR]
[TD]1 2[/TD]
[/TR]
[TR]
[TD]1 2 3[/TD]
[/TR]
[TR]
[TD]1 2 3 4[/TD]
[/TR]
</tbody>[/TABLE]







.. you could use something like :
Code:
=TEXT(A1,REPT("# ",4))
in another column or simply set the format of the column using the Custom Formatting option and set the cell format to "# # # #".

Of course if you want to do this only when your numbers will fit in your 7-digit wide area suitably "spaced out" (and you might have numbers bigger than 9999, ie you might have numbers all the way up to 7 digits) then you could do something like :
Code:
=IF(LEN(A1)<5,TEXT(A1,"# # # #"),A1)
.

And of course if my guess as to what you meant is not accurate, then you'll have to describe the effect you want more clearly. ;)

Cheers,

Warren K.
 
Last edited:
Upvote 0
Thank you for your answer and sorry my bad english. The table you posted below, where in 4th box you have numbers 1 2 3 4. I want number 1 to stand at the left end and 4 to stand at the right border. Spread those 4 numbers so that they have even space (maximum and even space) among them. I do not want to use spaces, because i want these digits constitute a number and later on use this in calculations.


[TABLE="class: grid, width: 150, align: left"]
<tbody>[TR]
[TD]1[/TD]
[/TR]
[TR]
[TD]1 2[/TD]
[/TR]
[TR]
[TD]1 2 3[/TD]
[/TR]
[TR]
[TD]1 2 3 4[/TD]
[/TR]
</tbody>[/TABLE]







Regards
 
Upvote 0
A better approach might be to use a text box linked to the cell - that way, the cell can be hidden or outside the visible range.
 
Upvote 0
Hi PJ,

The solution I gave you will already do that.

It will space the numbers FOR DISPLAY only across the 7 characters of the cell. They will still be NUMBERS and you can perform other calculations on them.

The diagram was just the default width of the table that displayed here. :)
 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,712
Members
452,995
Latest member
isldboy

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