Align decimal point when two numbers have different sign

OldSwimmer1650

New Member
Joined
Dec 3, 2020
Messages
38
Office Version
  1. 365
Platform
  1. Windows
I'm trying align the decimal points of these two numbers. The problem is when one is negative and the other positive they don't align. I would also like not to show leading zeros.
This is for a stock picking game for a finance class.

My expression is:
=CONCATENATE(XLOOKUP(MAX(Stocks!J17:J27),Stocks!J17:J27,CurrentStocks,,0)," ",TEXT(MAX(Stocks!J17:J27),"$0,000,000.00"))
(note: The expression is the same for both Winner & Looser except Min used for Looser and Max used for Winner)
1717608602856.png



I've also tried:
=CONCATENATE(XLOOKUP(MAX(Stocks!J17:J27),Stocks!J17:J27,CurrentStocks,,0)," ",TEXT( MAX(Stocks!J17:J27),"$#,000.00"))
(note: The expression is the same for both Winner & Looser except Min used for Looser and Max used for Winner)
1717608860920.png
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Shouldn't "Looser" be "Loser" ("Loser" is the opposite of "Winner" -- "Looser" mean "less tight" in the English language!")

Also for the last past, instead of:
Excel Formula:
TEXT(MAX(Stocks!J17:J27),"$#,000.00"))
I would use:
Excel Formula:
TEXT(MAX(Stocks!J17:J27),"$#,##0.00"))
or else you will have leading zeroes on any number between -999.99 and 999.99.

The issue that you are going to have is that if you combine all these in one cell with the CONCATENATE function, you are creating one long string.
If you want the numbers at the end to line up, then you have to do the following:
- choose a font where all letters are the same width
- count the number of characters in each of the three parts of your concatenate function, and pad them with extra spaces where necessary.

Of course, if you just kept these in 2 or 3 separate columns, so that the last part was a number and not text, they would line up nicely on their own.
 
Upvote 0
Can't you just use "Align Right" option?
View attachment 112330
Then the left-side of that string won't line up!
It looks to me like they want each of the 3 pieces of the string to line up (the first two left-justified and the number right-justified).
If it was me, I would probably just keep it as three separate cells and not mess around with messy formulas.
 
Upvote 0
Shouldn't "Looser" be "Loser" ("Loser" is the opposite of "Winner" -- "Looser" mean "less tight" in the English language!")

Also for the last past, instead of:
Excel Formula:
TEXT(MAX(Stocks!J17:J27),"$#,000.00"))
I would use:
Excel Formula:
TEXT(MAX(Stocks!J17:J27),"$#,##0.00"))
or else you will have leading zeroes on any number between -999.99 and 999.99.

The issue that you are going to have is that if you combine all these in one cell with the CONCATENATE function, you are creating one long string.
If you want the numbers at the end to line up, then you have to do the following:
- choose a font where all letters are the same width
- count the number of characters in each of the three parts of your concatenate function, and pad them with extra spaces where necessary.

Of course, if you just kept these in 2 or 3 separate columns, so that the last part was a number and not text, they would line up nicely on their own.
Unfortunately, I only have one cell to work with. Diction and grammar are always the last things I work on. This is just an initial mock-up. Thank you for your input. I really appreciate it.
 
Upvote 0
Upvote 0
Solution
You could pad with blanks, and use a font with a fixed character width. I've used Courier New below, as it wouldn't work with my usual Arial font.

Book1
ABC
1Gain/Loss WinnerNVDA1,328,872.79
2Gain/Loss LoserIIII0.00
3Gain/Loss WinnerXXXX123.00
4
5Gain/Loss Winner NVDA $1,328,872.79
6Gain/Loss Loser IIII $0.00
7Gain/Loss Winner XXXX $123.00
Sheet1
Cell Formulas
RangeFormula
A5:A7A5=LEFT(A1&" ",18)& B1 &RIGHT(REPT(" ",10)&TEXT(C1,"$#,##0.00"),15)
Thank you very much for the input. Worked fine! Key was the font.
 
Upvote 0

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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