Formatting a formula

beckys

Board Regular
Joined
Apr 19, 2005
Messages
116
Hello,
I have the following formula:

IF(ROUND(J98,2)=ROUND(SUMIF('Sheet2'!$A$8:$A$1000,C97,'Sheet2'!$D$8:$D$1000),2), "OK", "Off By "&J98-SUMIF('Sheet2'!$A$8:$A$1000,C97,'Sheet2'!$D$8:$D$1000))


When the result is false, the text that gets entered in the cell goes out to many decimal points, i.e. "off by 0.0246271358543424". Do you know how to format this so that the text would read "off by 0.02"?

Thanks!!
Becky
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

RSXchin

Well-known Member
Joined
Oct 23, 2010
Messages
758
Like this?
Code:
=IF(ROUND(J98,2)=ROUND(SUMIF(Sheet2!$A$8:$A$1000,C97,Sheet2!$D$8:$D$1000),2), "OK", "Off By "& format(J98-SUMIF(Sheet2!$A$8:$A$1000,C97,Sheet2!$D$8:$D$1000),"0.00"))
 

T. Valko

Well-known Member
Joined
May 9, 2009
Messages
16,623
Like this?
=IF(ROUND(J98,2)=ROUND(SUMIF(Sheet2!$A$8:$A$1000,C97,Sheet2!$D$8:$D$1000),2), "OK", "Off By "& format(J98-SUMIF(Sheet2!$A$8:$A$1000,C97,Sheet2!$D$8:$D$1000),"0.00"))
Never heard of the "format" function.

I'll be you meant to use TEXT(...).

=IF(ROUND(J98,2)=ROUND(SUMIF(Sheet2!$A$8:$A$1000,C97,Sheet2!$D$8:$D$1000),2),"OK","Off By "&TEXT(J98-SUMIF(Sheet2!$A$8:$A$1000,C97,Sheet2!$D$8:$D$1000),"0.00"))
 

RSXchin

Well-known Member
Joined
Oct 23, 2010
Messages
758
lol. yeah, I meant "TEXT". I'm so used to VB now... I barely know excel itself anymore.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,514
Messages
5,596,610
Members
414,080
Latest member
penguin23

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