× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Darrell,

Instead of

=IF(AG37=0,"00%",AG28-K28-M28-E28-G28)/AG37

Try

=IF(AG37=0,"00%",(AG28-K28-M28-E28-G28)/AG37)

Bob Elliott
Sr Programmer
City of Winchester
15 North Cameron St
Winchester, VA 22601
Phone: (540)-667-1815 ext 1462
Fax (540)-722-3618



-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of DLee@xxxxxxxx
Sent: Friday, May 11, 2007 1:56 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: POI excel formula

Happy Friday all;

Problem I'm working on is to create a formula that looks like this:

=IF(AG37=0,"00%",AG28-K28-M28-E28-G28)/AG37

The above formula works fine, except if AG37 is 0, Then I get a #div
error.

This is the code I'm using to get the above formula

formulastr = 'IF('+drtot_c + '=0,"00%", '+
%trim(sbtot_c) + '-' +
%trim(gaprt_k) + '-' +
%trim(gaprt_m) + '-' +
%trim(cpirt_e) + '-' +
%trim(cpirt_g) + ')' + '/' +
%trim(drtot_c);

hssf_formula( row:32: %trim(formulastr):Percent);

If I go into excel and change the formula as follows, I get rid of the
#div error.

=IF(AG37=0,"00%",(AG28-K28-M28-E28-G28)/AG37

But if I change the rpg code, I get a Java exception
"java.lang.RuntimeException: Cannot Parse, sorry : Integer
Expected" when calling method "setC" with signature "" in class
"org.apache.poi.hssf.usermodel.HSSFCell".

formulastr = 'IF('+drtot_c + '=0,"00%", '+
'(' +%trim(sbtot_c) + '-' +
%trim(gaprt_k) + '-' +
%trim(gaprt_m) + '-' +
%trim(cpirt_e) + '-' +
%trim(cpirt_g) + ')' + '/' +
%trim(drtot_c);

Thanks in advance.


Darrell Lee
Information Technology
Extension 7127

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.