Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Right Justify Cell using a formula

Status
Not open for further replies.

cuetzpalin

Programmer
Jun 5, 2002
99
US
Hello,

My excel spreadsheet populates through a linked table. I was able to format the field to diplay decimals by using:
=TEXT(A2,"0.00").

However, it defaults to left justification. I'd like to know if there is an option to right justify the output using the formula or if there is a TO NUMBER format?

I can't use the alignment buttons or right-click/right justify because the worksheet is protected.

Please advise.

Thanks in advance!
 
Formulas return a result, they cannot impart any formatting on a cell.

Text defaults to left-justification and numbers default to right-justification.

The reason you're getting left-justified data is that the TEXT function returns.... Text. (That has nothing to do with cell formatting - it is the type of data that is returned.)

It sound like you want to return a NUMBER, not text.

To do that, you'll use a formula that returns numbers.

Try ROUND, ROUNDDOWN or ROUNDUP.

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
THanks for the tip. Round doesn't display the decimal places if it equals to 00. So, in the meantime I got the author of the form to unlock the cells, so I just formatted the cells to Numeric with 2 decimal places. Thanks!
 


Please explain what you are attempting to do more clearly.

But in the mean time, hear's an for instance...

Suppose you have a number like...
[tt]
4.456789
[/tt]
You chose to use the TEXT function to get "TEXT" in a 0.00 "format" As john explained, TEXT is useless for doing arithmetic or collating.

Maybe you want to DISPLAY your number in a 0.00 format. There are a number of ways to do this. John suggested ROUNDING, which changes the numeric value. You could also use a simple numeric format via Format > Cell > Number TAB: Number format with 2 decimal places. In this case you would see DISPLAYED 4.46 HOWEVER the VALUE in the cell is still 4.456789.

You have to decide what you want to happen.

Skip,
[sup][glasses]Don't let the Diatribe...
talk you to death![tongue][/sup][sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks Skip! I opted to go the easy way and had the author unlock the worksheet, so I was able to format the cells as numeric with 2 decimal places.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top