If cell has a currency with cents, show that value otherwise show the #

Peptide

Board Regular
Joined
Apr 12, 2016
Messages
224
Office Version
  1. 365
Platform
  1. Windows
Hello -looking for some help. Thanks in advance!


A1 = $12.55

B1 - If A1 has any cents (.01 - .99), show that full # or $12.55. If there are no cents (i.e. 12.00), then show only the $, not the cents or $12

Example 1
A1 = $12.55
B1 = $12.55

Example 2
A1 = $12.00
B1 = $12
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
There are a few ways to do this. Assuming you have A1 and A2 formatted as currency, you can use this formula in A2:

=IF(INT(A1)<>A1,A1,TEXT(A1,"$#"))

The downside is that when it is an even dollar amount, what comes out is a text string, not a numeric value. But that might work for you.

Another way is to use Conditional formatting. Select A2, click Conditional Formatting > New Rule > Use a formula > and enter:

=INT(A1)=A1

click Format... > Number > Currency > and scroll the decimal places to 0. Or choose whatever format you want. Click OK. That will leave the value as a number, but display it as you desire.
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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