Results 1 to 14 of 14

How do I get a right justified column of numbers

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-15-2012
    Location
    Buffalo, NY
    MS-Off Ver
    Office 365
    Posts
    319

    How do I get a right justified column of numbers

    I have a column of numbers ranging from about 1 to about 999 (1 to 3 digits). I want these values to appear in a column in a report, right-justified.

    <Disclaimer> Yes - I know Excel is not a report writer, and Yes - I know that if I want to think in COBOL I should go back to the dim and distant past </Disclaimer>

    BUT

    How do I get a column of numbers in a report (a series of strings) to show up right justified?

    I've tried all sorts of format codes, and none of them work (they all shift the value to the left). I've worked around this in the past by prepending a string (comprised of spaces) of the maximum length adding the numerical value and then taking the rightmost characters:

    a=1
    
    result1=right(string(6," ") & a,6)
    
    a=999
    
    result2=right(string(6," ") & a,6)
    t hi s seem slik a pre tty st o o o PID wa yt od ot hi ng s!


    Can Excel VBA produce this rather basic request without requiring these contortions?

    Tony (Head Against Wall Mode Again)
    Last edited by tfurnivall; 04-09-2025 at 02:38 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-15-2016, 07:05 PM
  2. Replies: 24
    Last Post: 08-08-2013, 08:30 PM
  3. Replies: 4
    Last Post: 04-30-2013, 06:46 PM
  4. [SOLVED] =IF(F2=0,"0",$D$2/$F$2) is formatting left justified I need it right justified but how?
    By Dark Prognosis in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-18-2012, 10:39 PM
  5. Right Justified
    By carley465 in forum Excel General
    Replies: 3
    Last Post: 10-19-2006, 06:00 PM
  6. rows top-justified & bottom-justified in same sheet looks bad
    By Jim 007 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-08-2006, 07:00 PM
  7. Replies: 1
    Last Post: 03-27-2005, 09:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1