+ Reply to Thread
Results 1 to 7 of 7

Cell alignment left means positive, right means negative

  1. #1
    Registered User
    Join Date
    06-06-2013
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    4

    Cell alignment left means positive, right means negative

    Hi Experts!

    I have a very weird accounting report that shows Debit and Credit numbers in one column and both positive and only the way how the number is aligned means whether it is debit or credit. It is just alignment and not spaces unfortunately. I find it impossible to work with it but there is no alternative. The report is 100000 lines so doing that manually is not an option either

    Is there any formula that would make cells aligned right negative? Or a way to filter them all in one go?

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: Cell alignment left means positive, right means negative

    I don't believe there is a built in Excel function that can read alignment. VBA can readily read the alignment property via the Range.HorizontalAlignment property https://docs.microsoft.com/en-us/off...ontalalignment
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert
    Join Date
    09-30-2019
    Location
    Chiangmai, Thailand
    MS-Off Ver
    Office 2016, Excel 2019
    Posts
    1,234

    Re: Cell alignment left means positive, right means negative

    Please try..

    Align left cells content.
    Then use numbere format similar to
    #,##0.00;* (#,##0.00)

    Regards.


    Edit: Seem I mis-understood again, sorry. T_T
    could you please upload a sample of file ?
    Last edited by menem; 02-12-2020 at 11:01 PM.

  4. #4
    Registered User
    Join Date
    06-06-2013
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    4

    Thumbs up Re: Cell alignment left means positive, right means negative

    A colleague of mine has found the solution:

    1) in next column add random letters or word for all rows (this is because the formula does not work with numbers for some reason), than copy format of the numbers column into the new column with letters.
    2) in the next column =cell("prefix",B1) where B1 is our cell with formatted letters. This gives either ' for left alignment or '' for right alignment.
    3) then it is just an easy "if" formula left to make it +1 or -1

    Thanks everyone!

  5. #5
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Cell alignment left means positive, right means negative

    To convert the left aligned numbers to negative values (within the cells containing the aligned numbers), give the following procedure a try (this looks longer than it actually takes to do)...

    1) Type -1 in an unused cell
    2) Select that cell and press CTRL+C to copy it
    3) Select the entire column containing your left and right aligned numbers
    4) Press CTRL+F to bring up the Find dialog box
    5) Click the "Options>>" button
    6) Click the "Format.." button
    7) Select the "Alignment" tab
    8) Click down arrow on the "Horizontal" drop down
    9) Select "Left (Indent)" from the list
    10) Click the "OK" button
    11) Click the "Find All" button
    12) Press CTRL+A (this selects all the left aligned cells)
    13) Click the "Close" button
    14) Click the down arrow on the "Paste" button (located on the Home tab)
    15) Click the "Paste Special.." item
    16) Select the "Multiply" option button
    17) Click the "OK" button

    All your left aligned numbers should now be right aligned negative values. You can clear the cell you put the -1 in.
    Last edited by Rick Rothstein; 02-13-2020 at 12:35 AM.

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: Cell alignment left means positive, right means negative

    another way you can use is get.cell

    go to formula --> name manager ---> click define and give name as alignment now in the refers to part type ==GET.CELL(8,Sheet1!$A1)
    assuming cells whose alignment you want to check is in A1 now close name manager

    go to C1 and type =alignment if formula gives 1 then its right alignment and if its two then its left alignment
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  7. #7
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Cell alignment left means positive, right means negative

    Quote Originally Posted by CoffeeTea View Post
    A colleague of mine has found the solution:

    1) in next column add random letters or word for all rows (this is because the formula does not work with numbers for some reason), than copy format of the numbers column into the new column with letters.
    2) in the next column =cell("prefix",B1) where B1 is our cell with formatted letters. This gives either ' for left alignment or '' for right alignment. . . .
    You have a very clever coworker. I'd considered CELL("prefix",...) but found out it only works with text. Clever indeed to copy the formatting then replace numbers with text to make CELL("prefix",...) work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. cells within cell means what
    By ramminani in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-24-2015, 02:37 PM
  2. does anyone know what the character T in a cell means
    By leedspaddy in forum Excel General
    Replies: 5
    Last Post: 03-18-2014, 01:28 PM
  3. comparing means by means of Least Significant Differences (LSD) method
    By rmrf in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-07-2013, 12:14 PM
  4. Replies: 6
    Last Post: 05-18-2010, 01:39 AM
  5. change the contents of a cell by means of a formula
    By Justme47 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2009, 12:25 PM
  6. CELL HAS A GREEN TRIANGULAR SPOT ON THE TOP. WHAT DOES IT MEANS.
    By Princess in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-21-2006, 03:00 PM
  7. what means 'blank cell'??
    By Ted in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-20-2005, 10:15 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