![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
FMP 8, Mac OSX I have 6 fields that are each results of a series of calculations. Call them A, B,C, D, E, and F. Any one or more may result in a product of 0 [ie: (a +b) * y * 0 = 0] so IsEmpty isn't an option in the calculation. I am a bit of a newbie at the more sophisticated functions such as "Count" and "Get.." Without typing in 36 Case/Results for all the possible configurations, is there an elegant way of calculating the average of just the non-zero fields? Thanks |
#3
| |||
| |||
|
|
In article <1177860435.785691.240... (AT) o5g2000hsb (DOT) googlegroups.com>, CRC123 <swan... (AT) windsongappraisals (DOT) com> wrote: FMP 8, Mac OSX I have 6 fields that are each results of a series of calculations. Call them A, B,C, D, E, and F. Any one or more may result in a product of 0 [ie: (a +b) * y * 0 = 0] so IsEmpty isn't an option in the calculation. I am a bit of a newbie at the more sophisticated functions such as "Count" and "Get.." Without typing in 36 Case/Results for all the possible configurations, is there an elegant way of calculating the average of just the non-zero fields? Thanks IsEmpty and Count aren't going to work since a value of 0 is not an empty field. The Get functions are of no use at all - they're mostly used to convert numbers to Text or vice-versa and obtain system stats (eg. Get(CurrentRecordNum) to obtain the current record' internal ID number). You also shouldn't need "36 Case / Results" - since you've only got six fields, at most you'll need six. Assuming you actually want the Average of just the non-zero fields, then something like this would work: NonZeroAverage Calculation, Number Result, Unstored = (A + B + C + D + E + F) / (6 - If (A = 0, 1, 0) - If (B = 0, 1, 0) - If (C = 0, 1, 0) - If (D = 0, 1, 0) - If (E = 0, 1, 0) - If (F = 0, 1, 0) ) You can use Case instead of If, if you really want to - it makes no difference when there's only one test-result being performed. Or the "more elegant" solution of: NonZeroAverage Calculation, Number Result, Unstored = (A + B + C + D + E + F) / (6 - (A = 0) - (B = 0) - (C = 0) - (D = 0) - (E = 0) - (F = 0)) This uses Boolean logic, where the tests "A = 0" are evaluated the same way as the full If statements, ie 1 for true and 0 for false. When any of the field contains 0 that field is subtracted from the total of 6 used to evaluate the Average. Helpful Harry Hopefully helping harassed humans happily handle handiwork hardships ;o) |
#4
| |||
| |||
|
|
n article <1177860435.785691.240210 (AT) o5g2000hsb (DOT) googlegroups.com>, CRC123 <swanson (AT) windsongappraisals (DOT) com> wrote: FMP 8, Mac OSX I have 6 fields that are each results of a series of calculations. Call them A, B,C, D, E, and F. Any one or more may result in a product of 0 [ie: (a +b) * y * 0 = 0] so IsEmpty isn't an option in the calculation. I am a bit of a newbie at the more sophisticated functions such as "Count" and "Get.." Without typing in 36 Case/Results for all the possible configurations, is there an elegant way of calculating the average of just the non-zero fields? Thanks IsEmpty and Count aren't going to work since a value of 0 is not an empty field. The Get functions are of no use at all - they're mostly used to convert numbers to Text or vice-versa and obtain system stats (eg. Get(CurrentRecordNum) to obtain the current record' internal ID number). |
#5
| |||
| |||
|
|
In article <300420070906259959%helpful_harry (AT) nom (DOT) de.plume.com>, Helpful Harry <helpful_harry (AT) nom (DOT) de.plume.com> wrote: n article <1177860435.785691.240210 (AT) o5g2000hsb (DOT) googlegroups.com>, CRC123 <swanson (AT) windsongappraisals (DOT) com> wrote: FMP 8, Mac OSX I have 6 fields that are each results of a series of calculations. Call them A, B,C, D, E, and F. Any one or more may result in a product of 0 [ie: (a +b) * y * 0 = 0] so IsEmpty isn't an option in the calculation. I am a bit of a newbie at the more sophisticated functions such as "Count" and "Get.." Without typing in 36 Case/Results for all the possible configurations, is there an elegant way of calculating the average of just the non-zero fields? Thanks IsEmpty and Count aren't going to work since a value of 0 is not an empty field. The Get functions are of no use at all - they're mostly used to convert numbers to Text or vice-versa and obtain system stats (eg. Get(CurrentRecordNum) to obtain the current record' internal ID number). Doesn't SUM(A1:A6)/COUNTIF(A1:A6,"<>0") do the job? |
#6
| |||
| |||
|
|
In article <1177860435.785691.240... (AT) o5g2000hsb (DOT) googlegroups.com>, CRC123 <swan... (AT) windsongappraisals (DOT) com> wrote: FMP 8, Mac OSX I have 6 fields that are each results of a series of calculations. Call them A, B,C, D, E, and F. Any one or more may result in a product of 0 [ie: (a +b) * y * 0 = 0] so IsEmpty isn't an option in the calculation. I am a bit of a newbie at the more sophisticated functions such as "Count" and "Get.." Without typing in 36 Case/Results for all the possible configurations, is there an elegant way of calculating the average of just the non-zero fields? Thanks IsEmpty and Count aren't going to work since a value of 0 is not an empty field. The Get functions are of no use at all - they're mostly used to convert numbers to Text or vice-versa and obtain system stats (eg. Get(CurrentRecordNum) to obtain the current record' internal ID number). You also shouldn't need "36 Case / Results" - since you've only got six fields, at most you'll need six. Assuming you actually want the Average of just the non-zero fields, then something like this would work: NonZeroAverage Calculation, Number Result, Unstored = (A + B + C + D + E + F) / (6 - If (A = 0, 1, 0) - If (B = 0, 1, 0) - If (C = 0, 1, 0) - If (D = 0, 1, 0) - If (E = 0, 1, 0) - If (F = 0, 1, 0) ) You can use Case instead of If, if you really want to - it makes no difference when there's only one test-result being performed. Or the "more elegant" solution of: NonZeroAverage Calculation, Number Result, Unstored = (A + B + C + D + E + F) / (6 - (A = 0) - (B = 0) - (C = 0) - (D = 0) - (E = 0) - (F = 0)) This uses Boolean logic, where the tests "A = 0" are evaluated the same way as the full If statements, ie 1 for true and 0 for false. When any of the field contains 0 that field is subtracted from the total of 6 used to evaluate the Average. Helpful Harry Hopefully helping harassed humans happily handle handiwork hardships ;o) |
#7
| |||
| |||
|
|
On Apr 29, 2:06 pm, Helpful Harry <helpful_ha... (AT) nom (DOT) de.plume.com wrote: In article <1177860435.785691.240... (AT) o5g2000hsb (DOT) googlegroups.com>, CRC123 <swan... (AT) windsongappraisals (DOT) com> wrote: FMP 8, Mac OSX I have 6 fields that are each results of a series of calculations. Call them A, B,C, D, E, and F. Any one or more may result in a product of 0 [ie: (a +b) * y * 0 = 0] so IsEmpty isn't an option in the calculation. I am a bit of a newbie at the more sophisticated functions such as "Count" and "Get.." Without typing in 36 Case/Results for all the possible configurations, is there an elegant way of calculating the average of just the non-zero fields? Thanks IsEmpty and Count aren't going to work since a value of 0 is not an empty field. The Get functions are of no use at all - they're mostly used to convert numbers to Text or vice-versa and obtain system stats (eg. Get(CurrentRecordNum) to obtain the current record' internal ID number). You also shouldn't need "36 Case / Results" - since you've only got six fields, at most you'll need six. Assuming you actually want the Average of just the non-zero fields, then something like this would work: NonZeroAverage Calculation, Number Result, Unstored = (A + B + C + D + E + F) / (6 - If (A = 0, 1, 0) - If (B = 0, 1, 0) - If (C = 0, 1, 0) - If (D = 0, 1, 0) - If (E = 0, 1, 0) - If (F = 0, 1, 0) ) You can use Case instead of If, if you really want to - it makes no difference when there's only one test-result being performed. Or the "more elegant" solution of: NonZeroAverage Calculation, Number Result, Unstored = (A + B + C + D + E + F) / (6 - (A = 0) - (B = 0) - (C = 0) - (D = 0) - (E = 0) - (F = 0)) This uses Boolean logic, where the tests "A = 0" are evaluated the same way as the full If statements, ie 1 for true and 0 for false. When any of the field contains 0 that field is subtracted from the total of 6 used to evaluate the Average. Helpful Harry Hopefully helping harassed humans happily handle handiwork hardships ;o) Tres elegant indeed! I shall whip it right up and keep you posted. Many Thanks. |
![]() |
| Thread Tools | |
| Display Modes | |
| |