Formula with multiple Conditions...

trone77

Board Regular
Joined
Dec 28, 2009
Messages
152
Office Version
  1. 2019
Platform
  1. Windows
I need two formula. Essentially I need an if statement that adds the greater difference of the two values, (Max - Average) or (Average - Min). I would like for the first formula to include the rules in Ex. 1 & Ex. 2. And for the second formula to include all three.

Ex. 1



77
76
82
74
74
72
73
74
76
78
78 Max 82
75 Average 75
70 Min 70

If the difference of Max (82) - the Average (75) is greater than or equal to the difference of the Average (75) - the Min (70), then simply add the difference of (7) to the Average (75), returning the value of (82).

Ex. 2


77
76
82
74
74
72
73
74
65
78
78 Max 82
75 Average 75
76 Min 65

If the difference of Average (75) - the Mn (65) is greater than or equal to the difference of the Max (82) - the Average (75), then simply add the difference (10) to the Average (75). Returning the value of (85).

Ex. 3


77
77
77
77
77
77
77
77
77
77
77 Max 77
77 Average 77
77 Min 77

And for the second version of the formula, I need an additional rule to be added. If all the values are the exact same to simply return the Max + 1, returning the value of (78).
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Thanks for that, please don't forget yo update your account details. ;)
How about
+Fluff 1.xlsm
ABCDEFGHIJK
1
2777777
3767677
4828277
5747477
6747477
7727277
8737377
9747477
10657677
11787877
1278Max8278Max8277Max77
1375Average7575Average7577Average77
1476Min6570Min7077Min77
15858278
16
Main
Cell Formulas
RangeFormula
C12,K12,G12C12=MAX(A2:A14)
C13,K13,G13C13=ROUND(AVERAGE(A2:A14),0)
C14,K14,G14C14=MIN(A2:A14)
B15,J15,F15B15=MAX(C12-C13,C13-C14,1)+C13
 
Upvote 0
Thanks, will do. One quick question. How would that formula look if I were to just use the column $A$2:$A14? I was using {=IF(MAX(A2:R14)-AVERAGE(A2:A14)>=AVERAGE(A2:A14)-MIN(A2:A14),MAX(A2:A14),(AVERAGE(A2:A14)-MIN(A2:A14)+(AVERAGE(A2:A14))))}
 
Upvote 0
How about
Excel Formula:
=MAX(MAX(A2:A14)-AVERAGE(A2:A14),AVERAGE(A2:A14)-MIN(A2:A14),1)+AVERAGE(A2:A14)
 
Upvote 0
It works except for a few scenarios, for instance when the differences of both are equal, (Max 82 Average 75 Min 68)...that formula still returns a value of 83 instead of 82. And when all of the values are the exactly the same it doesn't add 1 to the max. Thanks again in advance for you help.
 
Upvote 0
Works for me
+Fluff 1.xlsm
ABCDIJK
1
27777
37677
48277
57477
67477
77277
87377
97477
106877
117877
1278Max8277Max77
1375Average7577Average77
1476Min6877Min77
158278
16
Main
Cell Formulas
RangeFormula
C12,K12C12=MAX(A2:A14)
C13,K13C13=AVERAGE(A2:A14)
C14,K14C14=MIN(A2:A14)
B15,J15B15=MAX(MAX(A2:A14)-AVERAGE(A2:A14),AVERAGE(A2:A14)-MIN(A2:A14),1)+AVERAGE(A2:A14)
 
Upvote 0
Ok try replacing the previous number with these:

77
76
82
75
74
72
73
75
76
78
78
75
68
 
Upvote 0
That is down to the fact that the average is not a whole number. If you want to avoid that you will need to use round as I initially showed.
 
Upvote 0

Forum statistics

Threads
1,215,438
Messages
6,124,873
Members
449,192
Latest member
MoonDancer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top