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

need help with a formula

Status
Not open for further replies.

jcalvin

Programmer
Jun 20, 2000
4
US
I have a database with a field Status. There are five statuses: a,b,c,d,e . I need to be able to show a number (count?) b,c,d,e while exluding a. These are all words. how can i return a number based on the number of fields that say b through e? Hope this is clear enough.<br><br>
 
I think you are asking if you could check number of occurances of each e.g. how many times b appears, how many times c appears on your report?<br><br>If this is so, implement a formula that counts the status <br>e.g. <br>declare variables for all status b through f<br>if status = 'b'<br>then statusb := 1 + statusb<br>else status = 'c'<br>then ...<br><br>At the end, you can get how many of each occured.<br>
 
I think you want one single figure showing how many records have status b to e. I would do this via a running total field.<br><br>Eg.<br>If your status code is in a field: filename.statusfld<br><br>Create a running total field where:<br><br>Summary<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Field to summarize&nbsp;&nbsp;&nbsp;&nbsp;filename.statusfld<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type of summary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count<br><br>Evaluate<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;. Use a formula<br><br>Press the formula button and enter a formula:<br><br>if totext({filename.statusfld}) = &quot;&quot; then false else<br>if instr(&quot;BCDE&quot;,{filename.statusfld})&gt;0 then true else false<br><br><br>The first 'if' is only needed if your status field could be null or an empty string. If this is never the case then omit it.<br><br>'OK' the edit box and drag the new field to your report footer. This should do the trick. <br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top