Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Math - A string is required here 1

Status
Not open for further replies.

wld1957

Technical User
Feb 3, 2006
68
US
I need a little help with my formuala's. CRXI
The field being evaluated is non-numeric.
My goal is to calulate a numeric amount from that field.

If amount is up to $5,000.00 then $25.00
If amount is between 5,001.00 to $25,000.00 then "$105.00"
If amount is between 25,001.00 to $50,000.00 then "180.00"
If over 50,000.00 then $1.00 for every thousand.
I was able to do two (2) formulas that work for below and above the $50,000.00 but when I try and put them together into one formula is comes back with a string is required here and highlights the "IF" in the last else if line.

1st is to calculate 35% of that field. I did this in a formula that works fine. I coverted the non numeric field to a number by formula(Co App to num) using.

If Not isNull({cpmain.udftext2}) Then
If isNumeric ({cpmain.udftext2}) Then ToNumber ({cpmain.udftext2})
Else 0

2nd - I used this formula to calulate 35%.
roundup ({@Co App to num} * .35,-1)


3rd - On the seventh line it stops and highlights the "IF" and states a string is required here.

If {cpmain.udfcheck1} = True then
if {@Co App 35%} <= 5000.00 then "25.00"
else if {@Co App 35%} >= 5001.00 and {@Co App 35%} <= 25000 then "105.00"
else if {@Co App 35%} >= 25001.00 and {@Co App 35%} <= 50000.00 then "180.00"
else if {@Co App 35%} >= 50001.00 then

RoundUp ({@Co App 35%}- 50000.00,-3)
* .003
+ 180.00

Else 0

Example
Number entered in field 360,200.00
35% is equal to 126,080.00
Since over $50,000.00
126,080.00 - 50,000.00 = 76,080.00
Rounded up to 77,000.00 X 3 = 231
231 + 180 = $411.00


Any suggesstions would be greatly appreciated. Thanks in advance.
 
The possible results of a formula have to be the same datatype, so remove the quotes around your numbers:

If {cpmain.udfcheck1} = True then
(
if {@Co App 35%} <= 5000 then
25 else
if {@Co App 35%} <= 25000 then
105 else
if {@Co App 35%} <= 50000.00 then
180 else
if {@Co App 35%} > 50000 then
RoundUp ({@Co App 35%}- 50000,-3)* .003 + 180.00
) Else
0

-LB
 
Thanks, it worked fine once I removed the quotes from the numbers. Still learning.... Thanks again it saved me time in getting this done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top