Formatting a number within concatenation

aaronmberg

New Member
Joined
Feb 2, 2006
Messages
10
Here is part of an If statement that I am using.

=IF(AND(B45<0,B45<(E45+F45)),"BUY"&" "&ROUND(ABS($B45-(E45+$F45)),0)

If this is true and it returns "BUY ####", how can I format the number to have a comma separating thousands (#,###)?

Thanks in advance!
 

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

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Try something like

=IF(AND(B45<0,B45< E45+F45),"BUY "&FIXED(ABS($B45-E45-$F45),0),0)
 

Artemus

Board Regular
Joined
Dec 30, 2004
Messages
92
You could also use

=IF(AND(B45<0,B45< E45+F45),"BUY "&TEXT(ABS($B45-E45+$F45),"#,###"),0)
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
Given your conditions $B45-E45-$F45 will always be negative when the IF condition is true so you don't really need ABS, you could use

=IF(AND(B45<0,B45< E45+F45),"BUY "&FIXED(E45+$F45-$B45,0),"")
 

Forum statistics

Threads
1,141,417
Messages
5,706,312
Members
421,441
Latest member
VapesRub

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
Top