Skip to main content
Question

Formula to find Total

  • April 22, 2020
  • 0 replies
  • 17 views

Hello,

I'm trying to write a formula that totals multiple fields based on the following calculation:

Step 1: Find the highest numbers of the fields
Step 2: Add the remaining fields and divide by 2
Step 3: Add the field with the highest number to the total of Step 2.

Example:

Field 1:  10
Field 2:  20
Field 3:  30
Field 4:  40

Field 4 would be the highest number (40)
Field 1+Field 2+Field 3=60
60/2=30+40=70

Any help is appreciated.  Thank you in advance.

------------------------------
TC
------------------------------
This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24
Sure, why not.  there is only so much Netflix I can handle at night.

var number Maximum = Max([Field 1],[Field 2],[Field 3],[Field 4]);

var number MaxFieldNumber =
If(
[Field 1]=$Maximum,1,
[Field 2]=$Maximum,2,
[Field 3]=$Maximum,3,
[Field 4]=$Maximum,4);

var number TotalOthers =
If($MaxFieldNumber<>1, [Field 1],0)
+
If($MaxFieldNumber<>2, [Field 2],0)
+
If($MaxFieldNumber<>3, [Field 3],0)
+
If($MaxFieldNumber<>4, [Field 4],0);

$Maximum + $TotalOthers/2



//Step 1: Find the highest numbers of the fields
//Step 2: Add the remaining fields and divide by 2
//Step 3: Add the field with the highest number to the total of Step 2.

//Example:

//Field 1: 10
//Field 2: 20
//Field 3: 30
//Field 4: 40

//Field 4 would be the highest number (40)
//Field 1+Field 2+Field 3=60
//60/2=30+40=70

------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.com
mark.shnier@gmail.com
------------------------------