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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Percentage of string

Status
Not open for further replies.

Lanie

Programmer
Jan 20, 2000
83
0
0
US
Hello Everyone,
We need a formula that finds the percentage of the number of occurances of the text "early", "N/S", based upon the total number of records pulled.

We have these formulas(so far):
@CntDescriptions
IF ISNULL({CUSTOMER_ORDER_JOIN\.REAL_SHIP_DATE})
THEN "N/S"
else IF {CUSTOMER_ORDER_JOIN\.WANTED_DELIVERY_DATE}>{CUSTOMER_ORDER_JOIN\.REAL_SHIP_DATE}
THEN "EARLY"


@CntRecords - counts the number of records for the report based upon the product number field.

Count ({CUSTOMER_ORDER_JOIN\.WANTED_DELIVERY_DATE})

@CntEarly - counts the total number of occurances for the text "early". (Also have one for "N/S")

if ({@CntDescriptions}= "EARLY" )then 1

This works well to find the number of times the text = early is found.

Now, I also need to find the percentages of "early" and "N/S".

We've tried a few formulas, but nothing works. We sure hope someone can figure this one out.

Thanks for your help, in advance.



Lanie
laniet@ij.net
etroidl@conaxfl.com


 
Thanks to everyone, but I found the answer by using the Running Total Fields.



Lanie
laniet@ij.net
etroidl@conaxfl.com


 
I'm not sure if I understand the scope well enough, but it sounds like you're almost there.

Here's a grand total precentage.

Use this formulafor early (similar to yours):
@earlycnt
if ({@CntDescriptions}= "EARLY" )then
1
else
0

Use this formula for n/s (similar to yours):
@n/scnt
if ({@CntDescriptions}= "EARLY" )then
1
else
0

Now in the report footer, use formulas containing:

(sum(@earlycnt)/recordnumber)*100

(sum(@n/scnt)/recordnumber)*100

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top