Solved

Crytal if formula

Posted on 2013-01-02
7
296 Views
Last Modified: 2013-02-13
I need help with a formula that show true if the price ends with a 0 or 5 and False if not.

Thanks!!!!
0
Comment
Question by:evend
7 Comments
 

Accepted Solution

by:
FLProfessional earned 167 total points
Comment Utility
it's a little dirty, but this should work:


local stringvar checkprice:=ToText(table.price, 2);

If { MID(checkprice,len(checkprice),1) = "0" or MID(checkprice,len(checkprice),1) = "5"} Then
   //put whatever you want here, it's true
Else
   // it's false
End If
0
 
LVL 100

Assisted Solution

by:mlmcc
mlmcc earned 167 total points
Comment Utility
Does price have decimals?  If so the formula above should work but it would be easier with RIGHT instead of MID

local stringvar checkprice:=ToText(table.price, 2);

If { Right(checkprice,1) = "0" or MID(checkprice,1) = "5"} Then
   //put whatever you want here, it's true
Else
   // it's false
End If

Open in new window


If prices are in dollars (no cents then)

local stringvar checkprice:=ToText(table.price, 0);

If { Right(checkprice,1) = "0" or MID(checkprice,1) = "5"} Then
   //put whatever you want here, it's true
Else
   // it's false
End If

Open in new window


mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 166 total points
Comment Utility
Converting the price to a string, as in the posts above, is the most flexible solution.  Then you can check for any digits you want.

 But since you're specifically looking for 0 and 5, Mod is another option.

 If your field is an integer:

({price field} Mod 5) = 0


 If your field has 2 decimal places and you want to check the last decimal place:

(({price field} * 100) Mod 5) = 0


 James
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:evend
Comment Utility
I've requested that this question be deleted for the following reason:

A friend helped me with.
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
What was your solution, you have 3 very plausible comments.

Did you try any of them?

If so what was the result?

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
You need to address the comments from the experts before deleting this question.

The comments provided are viable solutions which should be accepted as such

mlmcc
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now