Custom Format Cells Formulas

banneduser123

Banned - Rules violations
Joined
Mar 29, 2006
Messages
181
Hi,


I need the following to happen

column A contains numbers....
in column B, I am trying to input a formula for custom format: so that the numbers will appear as such

column A: 32,458,000 ; column B will show +32MM
column A: -100,000 ; column B will show -100K

im currently using the below formula, but it doesn't give me the + or - sign

[>=1000000] #,##0.00,,"MM";[>0] #,##0,"K";General


in column
 
This formula would convert your numbers to look the way you want, I constructed the formula to round to 2 decimal points, you can change that as you wish, keep in mind the ending result is TEXT.


Excel 2010
AC
132458000+32.46MM
2-100000-100K
3110587+110.59K
4-1678400-1.68MM
Sheet1
Cell Formulas
RangeFormula
C1=IF(A1>1000000,"+"&0+ROUND(A1/1000000,2)&"MM",IF(A1>0,"+"&ROUND(A1/1000,2)&"K",IF(A1<-999999,ROUND(A1/1000000,2)&"MM",IF(A1<0,ROUND(A1/1000,2)&"K",A1))))

C1 formula copied down.
 
Upvote 0

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
You cannot Custom Format the cell the way you want, but you can use a macro that will look at the cell value and apply the appropriate number format for that value...
Code:
Sub KMformat()
  Dim Cell As Range, Pattern As String
  For Each Cell In Range("A1", Cells(Rows.Count, "A").End(xlUp))
    Cell.NumberFormat = "General"
    Select Case Cell.Value
      Case Is <= -1000000: Pattern = "0.00,,\M\M"
      Case Is <= -1000: Pattern = "0,\K"
      Case Is >= 1000000: Pattern = "+0.00,,\M\M"
      Case Is >= 1000: Pattern = "+0,\K"
    End Select
    Cell.NumberFormat = Pattern
  Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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