Average calculation for multiple non adjacent columns with criteria
I am trying to build a quarterly report with avg numbers for each physician and avg for specialty. i wanted to use the avgs to compare to compare how the physician performance on these metrics comparing the the entire group with the same specialty. my problem is the average formula for the group is counting the zeros (if i use formula 2) I don't the zeros to be counted in the average.
I solved the problem for the physician average (column M,N,O) by using formula 1. but can't figure out for the columns Q,R,S.
Formula 1
=SUM(C3,F3,I3)/SUM(IF(C3=0,0,1),IF(F3=0,0,1),IF(I3=0,0,1))
Formula 2
=AVERAGEIF(iferror(AVERAGEIFS(C3:C24,B3:B24,B3,C3:C24,"<>0"),0),iferror(AVERAGEIFS(F3:F24,B3:B24,B3,F3:F24,"<>0"),0),iferror(AVERAGEIFS(I3:24,B3:B24,B3,I3:24,"<>0"),0))
microsoft-excel average
add a comment |
I am trying to build a quarterly report with avg numbers for each physician and avg for specialty. i wanted to use the avgs to compare to compare how the physician performance on these metrics comparing the the entire group with the same specialty. my problem is the average formula for the group is counting the zeros (if i use formula 2) I don't the zeros to be counted in the average.
I solved the problem for the physician average (column M,N,O) by using formula 1. but can't figure out for the columns Q,R,S.
Formula 1
=SUM(C3,F3,I3)/SUM(IF(C3=0,0,1),IF(F3=0,0,1),IF(I3=0,0,1))
Formula 2
=AVERAGEIF(iferror(AVERAGEIFS(C3:C24,B3:B24,B3,C3:C24,"<>0"),0),iferror(AVERAGEIFS(F3:F24,B3:B24,B3,F3:F24,"<>0"),0),iferror(AVERAGEIFS(I3:24,B3:B24,B3,I3:24,"<>0"),0))
microsoft-excel average
add a comment |
I am trying to build a quarterly report with avg numbers for each physician and avg for specialty. i wanted to use the avgs to compare to compare how the physician performance on these metrics comparing the the entire group with the same specialty. my problem is the average formula for the group is counting the zeros (if i use formula 2) I don't the zeros to be counted in the average.
I solved the problem for the physician average (column M,N,O) by using formula 1. but can't figure out for the columns Q,R,S.
Formula 1
=SUM(C3,F3,I3)/SUM(IF(C3=0,0,1),IF(F3=0,0,1),IF(I3=0,0,1))
Formula 2
=AVERAGEIF(iferror(AVERAGEIFS(C3:C24,B3:B24,B3,C3:C24,"<>0"),0),iferror(AVERAGEIFS(F3:F24,B3:B24,B3,F3:F24,"<>0"),0),iferror(AVERAGEIFS(I3:24,B3:B24,B3,I3:24,"<>0"),0))
microsoft-excel average
I am trying to build a quarterly report with avg numbers for each physician and avg for specialty. i wanted to use the avgs to compare to compare how the physician performance on these metrics comparing the the entire group with the same specialty. my problem is the average formula for the group is counting the zeros (if i use formula 2) I don't the zeros to be counted in the average.
I solved the problem for the physician average (column M,N,O) by using formula 1. but can't figure out for the columns Q,R,S.
Formula 1
=SUM(C3,F3,I3)/SUM(IF(C3=0,0,1),IF(F3=0,0,1),IF(I3=0,0,1))
Formula 2
=AVERAGEIF(iferror(AVERAGEIFS(C3:C24,B3:B24,B3,C3:C24,"<>0"),0),iferror(AVERAGEIFS(F3:F24,B3:B24,B3,F3:F24,"<>0"),0),iferror(AVERAGEIFS(I3:24,B3:B24,B3,I3:24,"<>0"),0))
microsoft-excel average
microsoft-excel average
edited Feb 6 at 21:08
Scott Craner
12.3k11218
12.3k11218
asked Feb 6 at 20:50
MoeMoe
1
1
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
(Edit: Alternate solution, more intuitive, at the end of this answer.)
This should do the trick. Paste the following into Q3:
=IFERROR(SUM(($B$3:$B$11=$B3)*(C$3:C$11+F$3:F$11+I$3:I$11))/SUM(($B$3:$B$11=$B3)*((C$3:C$11<>0)+(F$3:F$11<>0)+(I$3:I$11<>0))),0)
Press Ctrl-Shift-Enter to make this an array formula.
Drag/copy the pasted formula across the two additional Specialty summation columns and the formulas' corresponding Rating data columns will be updated. While all three cells are still selected, drag/copy the three selected cells to the last row of physicians. Excel will update all the Specialty filter row numbers to the corresponding summation row.
How it works:
- First the equality test
=$B3
against the Specialty column array creates a single column boolean array. If the current formula row Specialty matches that of the Specialty column row, the array will containTRUE
in that row of the created boolean array andFALSE
otherwise. - A second single column array is created by combining the three single column arrays, one for each month of the current Rating. This is done by adding July+Aug+Sep together row by row to create a single column array of the three month total of each Physician for the given Rating.
- The corresponding row values in these two arrays are then multiplied together.
- Any
FALSE
boolean value is automatically converted by Excel to zero when used in a math expression. This zeros out the Specialties which are not equal to the formula row. TheTRUE
boolean values are converted to one which is then multiplied by the rating summation for the corresponding row preserving the value of the 3 month sum for that Speciality in that row. The result is an array having zero in rows not part of the formula row Specialty.
- Any
- Then the resultant array is summed up with
SUM
. - This sum is divided by a similar summation.
- The same boolean filter array is created to filter out Specialties not equivalent to the formulas' row Specialty.
- This time, each element of the second calculated array is the number of months in that particular row which have a non zero value. This is accomplished by performing a "not zero test"
<>0
for each item in each of the three single column arrays of data (one array of data for each month of the given Rating). - With the resulting three single column boolean arrays, the items of a given row of each array are added together to create the calculated second array. Since these are boolean values returned by the expression to test for a non zero value, again Excel automatically converts the
TRUE
values to one and theFALSE
values to zero when asked to do this arithmetic addition. - This single column array with values in each row ranging from 0 to 3 is then multiplied, row by row, with the boolean filter array, zeroing any rows in the array which are not the same Specialty as the current formula row (as described earlier).
- Again the resultant array is summed to obtain the divisor used to calculate the average.
- The
IFERROR
replaces division by zero errors with zero.
[Edit] Alternate solution. A more intuitive formula which is not CSE:
=IFERROR((
SUMIFS( C$3:C$12, $B$3:$B$12, $B3) +
SUMIFS( F$3:F$12, $B$3:$B$12, $B3) +
SUMIFS( I$3:I$12, $B$3:$B$12, $B3)
) / (
COUNTIFS( $B$3:$B$12, $B3, C$3:C$12, "<>0", C$3:C$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, F$3:F$12, "<>0", F$3:F$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, I$3:I$12, "<>0", I$3:I$12, "<>")), 0)
add a comment |
You can use this Array Formula also:
{=ROUND(SUM(IF($F$25:$F$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$F$25:$F$34),IF($G$25:$G$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$G$25:$G$34),IF($H$25:$H$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$H$25:$H$34),0))))/3,2)}
- Since it's CSE formula so finish it with Ctrl+Shift+Enter.
Edited:
You may try this Formula, which is better & efficient than Formula shown above.
=ROUND(IFERROR(SUMIFS($T$2:$T$11,$S$2:$S$11,$S$1,$T$2:$T$11,">0")+SUMIFS($U$2:$U$11,$S$2:$S$11,$S$1,$U$2:$U$11,">0")+SUMIFS($V$2:$V$11,$S$2:$S$11,$S$1,$V$2:$V$11,">0"),0)/(COUNTIFS($S$2:$S$11,$S$1,$T$2:$T$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$U$2:$U$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$V$2:$V$11,">0")),2)
N.B.
- Data Range is
S2:V11
. - Criteria in Cell
S1
. - Adjust cell references in both the
formulas as needed.
Actual Calculation of this Formula: For each time F does not equal 0 (even when E of the row does not equal "A"), return to SUM the AVERAGE of F (where E="A", even average in the zeros): 9*(18/5) [missing red highlighting in row 25]. SUM will also get the average of G (where E="A") for every row of F=0 if the same row of G<>0 (regardless of Es value): 1*(73/5). For each row with E=0 & F=0 & G<>0 then SUM the AVERAGE of G (where E="A") that number of times. All that divided by 3 (even if all else was correct, this would assume the same number of zeros per column). (9*(18/5) + 73/5)/3 = 15.67
– Ted D.
Feb 15 at 22:21
1
Write your concern, why down voted, help me to make my viewpoint clear !!
– Rajesh S
Mar 1 at 8:29
You may have been down voted because of my comment. Your result 15.67 is calculated as outlined in my comment 15.67, which is completely wrong and you never bothered to fix it. The formula you use does not ignore zeros as stipulated in the OP. By dividing by three, your formula is weighting every column equally, so even if the zeros had been ignored, if there were a different number of zeros in one column, this would not be right. The formula you use sums the average from the first column multiple times and never averages the third column.
– Ted D.
Mar 1 at 14:53
1
@TedD.,, thanks for the observation,, do you have any suggestion that where my Formula need correction?
– Rajesh S
Mar 2 at 6:37
1
@TedD., thanks for the time you have invested on the issue, what I do believe that you must add an alternative Formula which exactly meets OP requirements along with the Analysis as a NEW ANSWER,, instead of edit my post,, will help the OP and the community also.
– Rajesh S
Mar 3 at 4:59
|
show 3 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1402856%2faverage-calculation-for-multiple-non-adjacent-columns-with-criteria%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
(Edit: Alternate solution, more intuitive, at the end of this answer.)
This should do the trick. Paste the following into Q3:
=IFERROR(SUM(($B$3:$B$11=$B3)*(C$3:C$11+F$3:F$11+I$3:I$11))/SUM(($B$3:$B$11=$B3)*((C$3:C$11<>0)+(F$3:F$11<>0)+(I$3:I$11<>0))),0)
Press Ctrl-Shift-Enter to make this an array formula.
Drag/copy the pasted formula across the two additional Specialty summation columns and the formulas' corresponding Rating data columns will be updated. While all three cells are still selected, drag/copy the three selected cells to the last row of physicians. Excel will update all the Specialty filter row numbers to the corresponding summation row.
How it works:
- First the equality test
=$B3
against the Specialty column array creates a single column boolean array. If the current formula row Specialty matches that of the Specialty column row, the array will containTRUE
in that row of the created boolean array andFALSE
otherwise. - A second single column array is created by combining the three single column arrays, one for each month of the current Rating. This is done by adding July+Aug+Sep together row by row to create a single column array of the three month total of each Physician for the given Rating.
- The corresponding row values in these two arrays are then multiplied together.
- Any
FALSE
boolean value is automatically converted by Excel to zero when used in a math expression. This zeros out the Specialties which are not equal to the formula row. TheTRUE
boolean values are converted to one which is then multiplied by the rating summation for the corresponding row preserving the value of the 3 month sum for that Speciality in that row. The result is an array having zero in rows not part of the formula row Specialty.
- Any
- Then the resultant array is summed up with
SUM
. - This sum is divided by a similar summation.
- The same boolean filter array is created to filter out Specialties not equivalent to the formulas' row Specialty.
- This time, each element of the second calculated array is the number of months in that particular row which have a non zero value. This is accomplished by performing a "not zero test"
<>0
for each item in each of the three single column arrays of data (one array of data for each month of the given Rating). - With the resulting three single column boolean arrays, the items of a given row of each array are added together to create the calculated second array. Since these are boolean values returned by the expression to test for a non zero value, again Excel automatically converts the
TRUE
values to one and theFALSE
values to zero when asked to do this arithmetic addition. - This single column array with values in each row ranging from 0 to 3 is then multiplied, row by row, with the boolean filter array, zeroing any rows in the array which are not the same Specialty as the current formula row (as described earlier).
- Again the resultant array is summed to obtain the divisor used to calculate the average.
- The
IFERROR
replaces division by zero errors with zero.
[Edit] Alternate solution. A more intuitive formula which is not CSE:
=IFERROR((
SUMIFS( C$3:C$12, $B$3:$B$12, $B3) +
SUMIFS( F$3:F$12, $B$3:$B$12, $B3) +
SUMIFS( I$3:I$12, $B$3:$B$12, $B3)
) / (
COUNTIFS( $B$3:$B$12, $B3, C$3:C$12, "<>0", C$3:C$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, F$3:F$12, "<>0", F$3:F$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, I$3:I$12, "<>0", I$3:I$12, "<>")), 0)
add a comment |
(Edit: Alternate solution, more intuitive, at the end of this answer.)
This should do the trick. Paste the following into Q3:
=IFERROR(SUM(($B$3:$B$11=$B3)*(C$3:C$11+F$3:F$11+I$3:I$11))/SUM(($B$3:$B$11=$B3)*((C$3:C$11<>0)+(F$3:F$11<>0)+(I$3:I$11<>0))),0)
Press Ctrl-Shift-Enter to make this an array formula.
Drag/copy the pasted formula across the two additional Specialty summation columns and the formulas' corresponding Rating data columns will be updated. While all three cells are still selected, drag/copy the three selected cells to the last row of physicians. Excel will update all the Specialty filter row numbers to the corresponding summation row.
How it works:
- First the equality test
=$B3
against the Specialty column array creates a single column boolean array. If the current formula row Specialty matches that of the Specialty column row, the array will containTRUE
in that row of the created boolean array andFALSE
otherwise. - A second single column array is created by combining the three single column arrays, one for each month of the current Rating. This is done by adding July+Aug+Sep together row by row to create a single column array of the three month total of each Physician for the given Rating.
- The corresponding row values in these two arrays are then multiplied together.
- Any
FALSE
boolean value is automatically converted by Excel to zero when used in a math expression. This zeros out the Specialties which are not equal to the formula row. TheTRUE
boolean values are converted to one which is then multiplied by the rating summation for the corresponding row preserving the value of the 3 month sum for that Speciality in that row. The result is an array having zero in rows not part of the formula row Specialty.
- Any
- Then the resultant array is summed up with
SUM
. - This sum is divided by a similar summation.
- The same boolean filter array is created to filter out Specialties not equivalent to the formulas' row Specialty.
- This time, each element of the second calculated array is the number of months in that particular row which have a non zero value. This is accomplished by performing a "not zero test"
<>0
for each item in each of the three single column arrays of data (one array of data for each month of the given Rating). - With the resulting three single column boolean arrays, the items of a given row of each array are added together to create the calculated second array. Since these are boolean values returned by the expression to test for a non zero value, again Excel automatically converts the
TRUE
values to one and theFALSE
values to zero when asked to do this arithmetic addition. - This single column array with values in each row ranging from 0 to 3 is then multiplied, row by row, with the boolean filter array, zeroing any rows in the array which are not the same Specialty as the current formula row (as described earlier).
- Again the resultant array is summed to obtain the divisor used to calculate the average.
- The
IFERROR
replaces division by zero errors with zero.
[Edit] Alternate solution. A more intuitive formula which is not CSE:
=IFERROR((
SUMIFS( C$3:C$12, $B$3:$B$12, $B3) +
SUMIFS( F$3:F$12, $B$3:$B$12, $B3) +
SUMIFS( I$3:I$12, $B$3:$B$12, $B3)
) / (
COUNTIFS( $B$3:$B$12, $B3, C$3:C$12, "<>0", C$3:C$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, F$3:F$12, "<>0", F$3:F$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, I$3:I$12, "<>0", I$3:I$12, "<>")), 0)
add a comment |
(Edit: Alternate solution, more intuitive, at the end of this answer.)
This should do the trick. Paste the following into Q3:
=IFERROR(SUM(($B$3:$B$11=$B3)*(C$3:C$11+F$3:F$11+I$3:I$11))/SUM(($B$3:$B$11=$B3)*((C$3:C$11<>0)+(F$3:F$11<>0)+(I$3:I$11<>0))),0)
Press Ctrl-Shift-Enter to make this an array formula.
Drag/copy the pasted formula across the two additional Specialty summation columns and the formulas' corresponding Rating data columns will be updated. While all three cells are still selected, drag/copy the three selected cells to the last row of physicians. Excel will update all the Specialty filter row numbers to the corresponding summation row.
How it works:
- First the equality test
=$B3
against the Specialty column array creates a single column boolean array. If the current formula row Specialty matches that of the Specialty column row, the array will containTRUE
in that row of the created boolean array andFALSE
otherwise. - A second single column array is created by combining the three single column arrays, one for each month of the current Rating. This is done by adding July+Aug+Sep together row by row to create a single column array of the three month total of each Physician for the given Rating.
- The corresponding row values in these two arrays are then multiplied together.
- Any
FALSE
boolean value is automatically converted by Excel to zero when used in a math expression. This zeros out the Specialties which are not equal to the formula row. TheTRUE
boolean values are converted to one which is then multiplied by the rating summation for the corresponding row preserving the value of the 3 month sum for that Speciality in that row. The result is an array having zero in rows not part of the formula row Specialty.
- Any
- Then the resultant array is summed up with
SUM
. - This sum is divided by a similar summation.
- The same boolean filter array is created to filter out Specialties not equivalent to the formulas' row Specialty.
- This time, each element of the second calculated array is the number of months in that particular row which have a non zero value. This is accomplished by performing a "not zero test"
<>0
for each item in each of the three single column arrays of data (one array of data for each month of the given Rating). - With the resulting three single column boolean arrays, the items of a given row of each array are added together to create the calculated second array. Since these are boolean values returned by the expression to test for a non zero value, again Excel automatically converts the
TRUE
values to one and theFALSE
values to zero when asked to do this arithmetic addition. - This single column array with values in each row ranging from 0 to 3 is then multiplied, row by row, with the boolean filter array, zeroing any rows in the array which are not the same Specialty as the current formula row (as described earlier).
- Again the resultant array is summed to obtain the divisor used to calculate the average.
- The
IFERROR
replaces division by zero errors with zero.
[Edit] Alternate solution. A more intuitive formula which is not CSE:
=IFERROR((
SUMIFS( C$3:C$12, $B$3:$B$12, $B3) +
SUMIFS( F$3:F$12, $B$3:$B$12, $B3) +
SUMIFS( I$3:I$12, $B$3:$B$12, $B3)
) / (
COUNTIFS( $B$3:$B$12, $B3, C$3:C$12, "<>0", C$3:C$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, F$3:F$12, "<>0", F$3:F$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, I$3:I$12, "<>0", I$3:I$12, "<>")), 0)
(Edit: Alternate solution, more intuitive, at the end of this answer.)
This should do the trick. Paste the following into Q3:
=IFERROR(SUM(($B$3:$B$11=$B3)*(C$3:C$11+F$3:F$11+I$3:I$11))/SUM(($B$3:$B$11=$B3)*((C$3:C$11<>0)+(F$3:F$11<>0)+(I$3:I$11<>0))),0)
Press Ctrl-Shift-Enter to make this an array formula.
Drag/copy the pasted formula across the two additional Specialty summation columns and the formulas' corresponding Rating data columns will be updated. While all three cells are still selected, drag/copy the three selected cells to the last row of physicians. Excel will update all the Specialty filter row numbers to the corresponding summation row.
How it works:
- First the equality test
=$B3
against the Specialty column array creates a single column boolean array. If the current formula row Specialty matches that of the Specialty column row, the array will containTRUE
in that row of the created boolean array andFALSE
otherwise. - A second single column array is created by combining the three single column arrays, one for each month of the current Rating. This is done by adding July+Aug+Sep together row by row to create a single column array of the three month total of each Physician for the given Rating.
- The corresponding row values in these two arrays are then multiplied together.
- Any
FALSE
boolean value is automatically converted by Excel to zero when used in a math expression. This zeros out the Specialties which are not equal to the formula row. TheTRUE
boolean values are converted to one which is then multiplied by the rating summation for the corresponding row preserving the value of the 3 month sum for that Speciality in that row. The result is an array having zero in rows not part of the formula row Specialty.
- Any
- Then the resultant array is summed up with
SUM
. - This sum is divided by a similar summation.
- The same boolean filter array is created to filter out Specialties not equivalent to the formulas' row Specialty.
- This time, each element of the second calculated array is the number of months in that particular row which have a non zero value. This is accomplished by performing a "not zero test"
<>0
for each item in each of the three single column arrays of data (one array of data for each month of the given Rating). - With the resulting three single column boolean arrays, the items of a given row of each array are added together to create the calculated second array. Since these are boolean values returned by the expression to test for a non zero value, again Excel automatically converts the
TRUE
values to one and theFALSE
values to zero when asked to do this arithmetic addition. - This single column array with values in each row ranging from 0 to 3 is then multiplied, row by row, with the boolean filter array, zeroing any rows in the array which are not the same Specialty as the current formula row (as described earlier).
- Again the resultant array is summed to obtain the divisor used to calculate the average.
- The
IFERROR
replaces division by zero errors with zero.
[Edit] Alternate solution. A more intuitive formula which is not CSE:
=IFERROR((
SUMIFS( C$3:C$12, $B$3:$B$12, $B3) +
SUMIFS( F$3:F$12, $B$3:$B$12, $B3) +
SUMIFS( I$3:I$12, $B$3:$B$12, $B3)
) / (
COUNTIFS( $B$3:$B$12, $B3, C$3:C$12, "<>0", C$3:C$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, F$3:F$12, "<>0", F$3:F$12, "<>") +
COUNTIFS( $B$3:$B$12, $B3, I$3:I$12, "<>0", I$3:I$12, "<>")), 0)
edited Feb 14 at 21:47
answered Feb 13 at 7:09
Ted D.Ted D.
68518
68518
add a comment |
add a comment |
You can use this Array Formula also:
{=ROUND(SUM(IF($F$25:$F$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$F$25:$F$34),IF($G$25:$G$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$G$25:$G$34),IF($H$25:$H$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$H$25:$H$34),0))))/3,2)}
- Since it's CSE formula so finish it with Ctrl+Shift+Enter.
Edited:
You may try this Formula, which is better & efficient than Formula shown above.
=ROUND(IFERROR(SUMIFS($T$2:$T$11,$S$2:$S$11,$S$1,$T$2:$T$11,">0")+SUMIFS($U$2:$U$11,$S$2:$S$11,$S$1,$U$2:$U$11,">0")+SUMIFS($V$2:$V$11,$S$2:$S$11,$S$1,$V$2:$V$11,">0"),0)/(COUNTIFS($S$2:$S$11,$S$1,$T$2:$T$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$U$2:$U$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$V$2:$V$11,">0")),2)
N.B.
- Data Range is
S2:V11
. - Criteria in Cell
S1
. - Adjust cell references in both the
formulas as needed.
Actual Calculation of this Formula: For each time F does not equal 0 (even when E of the row does not equal "A"), return to SUM the AVERAGE of F (where E="A", even average in the zeros): 9*(18/5) [missing red highlighting in row 25]. SUM will also get the average of G (where E="A") for every row of F=0 if the same row of G<>0 (regardless of Es value): 1*(73/5). For each row with E=0 & F=0 & G<>0 then SUM the AVERAGE of G (where E="A") that number of times. All that divided by 3 (even if all else was correct, this would assume the same number of zeros per column). (9*(18/5) + 73/5)/3 = 15.67
– Ted D.
Feb 15 at 22:21
1
Write your concern, why down voted, help me to make my viewpoint clear !!
– Rajesh S
Mar 1 at 8:29
You may have been down voted because of my comment. Your result 15.67 is calculated as outlined in my comment 15.67, which is completely wrong and you never bothered to fix it. The formula you use does not ignore zeros as stipulated in the OP. By dividing by three, your formula is weighting every column equally, so even if the zeros had been ignored, if there were a different number of zeros in one column, this would not be right. The formula you use sums the average from the first column multiple times and never averages the third column.
– Ted D.
Mar 1 at 14:53
1
@TedD.,, thanks for the observation,, do you have any suggestion that where my Formula need correction?
– Rajesh S
Mar 2 at 6:37
1
@TedD., thanks for the time you have invested on the issue, what I do believe that you must add an alternative Formula which exactly meets OP requirements along with the Analysis as a NEW ANSWER,, instead of edit my post,, will help the OP and the community also.
– Rajesh S
Mar 3 at 4:59
|
show 3 more comments
You can use this Array Formula also:
{=ROUND(SUM(IF($F$25:$F$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$F$25:$F$34),IF($G$25:$G$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$G$25:$G$34),IF($H$25:$H$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$H$25:$H$34),0))))/3,2)}
- Since it's CSE formula so finish it with Ctrl+Shift+Enter.
Edited:
You may try this Formula, which is better & efficient than Formula shown above.
=ROUND(IFERROR(SUMIFS($T$2:$T$11,$S$2:$S$11,$S$1,$T$2:$T$11,">0")+SUMIFS($U$2:$U$11,$S$2:$S$11,$S$1,$U$2:$U$11,">0")+SUMIFS($V$2:$V$11,$S$2:$S$11,$S$1,$V$2:$V$11,">0"),0)/(COUNTIFS($S$2:$S$11,$S$1,$T$2:$T$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$U$2:$U$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$V$2:$V$11,">0")),2)
N.B.
- Data Range is
S2:V11
. - Criteria in Cell
S1
. - Adjust cell references in both the
formulas as needed.
Actual Calculation of this Formula: For each time F does not equal 0 (even when E of the row does not equal "A"), return to SUM the AVERAGE of F (where E="A", even average in the zeros): 9*(18/5) [missing red highlighting in row 25]. SUM will also get the average of G (where E="A") for every row of F=0 if the same row of G<>0 (regardless of Es value): 1*(73/5). For each row with E=0 & F=0 & G<>0 then SUM the AVERAGE of G (where E="A") that number of times. All that divided by 3 (even if all else was correct, this would assume the same number of zeros per column). (9*(18/5) + 73/5)/3 = 15.67
– Ted D.
Feb 15 at 22:21
1
Write your concern, why down voted, help me to make my viewpoint clear !!
– Rajesh S
Mar 1 at 8:29
You may have been down voted because of my comment. Your result 15.67 is calculated as outlined in my comment 15.67, which is completely wrong and you never bothered to fix it. The formula you use does not ignore zeros as stipulated in the OP. By dividing by three, your formula is weighting every column equally, so even if the zeros had been ignored, if there were a different number of zeros in one column, this would not be right. The formula you use sums the average from the first column multiple times and never averages the third column.
– Ted D.
Mar 1 at 14:53
1
@TedD.,, thanks for the observation,, do you have any suggestion that where my Formula need correction?
– Rajesh S
Mar 2 at 6:37
1
@TedD., thanks for the time you have invested on the issue, what I do believe that you must add an alternative Formula which exactly meets OP requirements along with the Analysis as a NEW ANSWER,, instead of edit my post,, will help the OP and the community also.
– Rajesh S
Mar 3 at 4:59
|
show 3 more comments
You can use this Array Formula also:
{=ROUND(SUM(IF($F$25:$F$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$F$25:$F$34),IF($G$25:$G$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$G$25:$G$34),IF($H$25:$H$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$H$25:$H$34),0))))/3,2)}
- Since it's CSE formula so finish it with Ctrl+Shift+Enter.
Edited:
You may try this Formula, which is better & efficient than Formula shown above.
=ROUND(IFERROR(SUMIFS($T$2:$T$11,$S$2:$S$11,$S$1,$T$2:$T$11,">0")+SUMIFS($U$2:$U$11,$S$2:$S$11,$S$1,$U$2:$U$11,">0")+SUMIFS($V$2:$V$11,$S$2:$S$11,$S$1,$V$2:$V$11,">0"),0)/(COUNTIFS($S$2:$S$11,$S$1,$T$2:$T$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$U$2:$U$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$V$2:$V$11,">0")),2)
N.B.
- Data Range is
S2:V11
. - Criteria in Cell
S1
. - Adjust cell references in both the
formulas as needed.
You can use this Array Formula also:
{=ROUND(SUM(IF($F$25:$F$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$F$25:$F$34),IF($G$25:$G$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$G$25:$G$34),IF($H$25:$H$34<>0,AVERAGEIF($E$25:$E$34,$F$24,$H$25:$H$34),0))))/3,2)}
- Since it's CSE formula so finish it with Ctrl+Shift+Enter.
Edited:
You may try this Formula, which is better & efficient than Formula shown above.
=ROUND(IFERROR(SUMIFS($T$2:$T$11,$S$2:$S$11,$S$1,$T$2:$T$11,">0")+SUMIFS($U$2:$U$11,$S$2:$S$11,$S$1,$U$2:$U$11,">0")+SUMIFS($V$2:$V$11,$S$2:$S$11,$S$1,$V$2:$V$11,">0"),0)/(COUNTIFS($S$2:$S$11,$S$1,$T$2:$T$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$U$2:$U$11,">0")+COUNTIFS($S$2:$S$11,$S$1,$V$2:$V$11,">0")),2)
N.B.
- Data Range is
S2:V11
. - Criteria in Cell
S1
. - Adjust cell references in both the
formulas as needed.
edited Mar 8 at 7:21
answered Feb 13 at 9:35
Rajesh SRajesh S
4,1061524
4,1061524
Actual Calculation of this Formula: For each time F does not equal 0 (even when E of the row does not equal "A"), return to SUM the AVERAGE of F (where E="A", even average in the zeros): 9*(18/5) [missing red highlighting in row 25]. SUM will also get the average of G (where E="A") for every row of F=0 if the same row of G<>0 (regardless of Es value): 1*(73/5). For each row with E=0 & F=0 & G<>0 then SUM the AVERAGE of G (where E="A") that number of times. All that divided by 3 (even if all else was correct, this would assume the same number of zeros per column). (9*(18/5) + 73/5)/3 = 15.67
– Ted D.
Feb 15 at 22:21
1
Write your concern, why down voted, help me to make my viewpoint clear !!
– Rajesh S
Mar 1 at 8:29
You may have been down voted because of my comment. Your result 15.67 is calculated as outlined in my comment 15.67, which is completely wrong and you never bothered to fix it. The formula you use does not ignore zeros as stipulated in the OP. By dividing by three, your formula is weighting every column equally, so even if the zeros had been ignored, if there were a different number of zeros in one column, this would not be right. The formula you use sums the average from the first column multiple times and never averages the third column.
– Ted D.
Mar 1 at 14:53
1
@TedD.,, thanks for the observation,, do you have any suggestion that where my Formula need correction?
– Rajesh S
Mar 2 at 6:37
1
@TedD., thanks for the time you have invested on the issue, what I do believe that you must add an alternative Formula which exactly meets OP requirements along with the Analysis as a NEW ANSWER,, instead of edit my post,, will help the OP and the community also.
– Rajesh S
Mar 3 at 4:59
|
show 3 more comments
Actual Calculation of this Formula: For each time F does not equal 0 (even when E of the row does not equal "A"), return to SUM the AVERAGE of F (where E="A", even average in the zeros): 9*(18/5) [missing red highlighting in row 25]. SUM will also get the average of G (where E="A") for every row of F=0 if the same row of G<>0 (regardless of Es value): 1*(73/5). For each row with E=0 & F=0 & G<>0 then SUM the AVERAGE of G (where E="A") that number of times. All that divided by 3 (even if all else was correct, this would assume the same number of zeros per column). (9*(18/5) + 73/5)/3 = 15.67
– Ted D.
Feb 15 at 22:21
1
Write your concern, why down voted, help me to make my viewpoint clear !!
– Rajesh S
Mar 1 at 8:29
You may have been down voted because of my comment. Your result 15.67 is calculated as outlined in my comment 15.67, which is completely wrong and you never bothered to fix it. The formula you use does not ignore zeros as stipulated in the OP. By dividing by three, your formula is weighting every column equally, so even if the zeros had been ignored, if there were a different number of zeros in one column, this would not be right. The formula you use sums the average from the first column multiple times and never averages the third column.
– Ted D.
Mar 1 at 14:53
1
@TedD.,, thanks for the observation,, do you have any suggestion that where my Formula need correction?
– Rajesh S
Mar 2 at 6:37
1
@TedD., thanks for the time you have invested on the issue, what I do believe that you must add an alternative Formula which exactly meets OP requirements along with the Analysis as a NEW ANSWER,, instead of edit my post,, will help the OP and the community also.
– Rajesh S
Mar 3 at 4:59
Actual Calculation of this Formula: For each time F does not equal 0 (even when E of the row does not equal "A"), return to SUM the AVERAGE of F (where E="A", even average in the zeros): 9*(18/5) [missing red highlighting in row 25]. SUM will also get the average of G (where E="A") for every row of F=0 if the same row of G<>0 (regardless of Es value): 1*(73/5). For each row with E=0 & F=0 & G<>0 then SUM the AVERAGE of G (where E="A") that number of times. All that divided by 3 (even if all else was correct, this would assume the same number of zeros per column). (9*(18/5) + 73/5)/3 = 15.67
– Ted D.
Feb 15 at 22:21
Actual Calculation of this Formula: For each time F does not equal 0 (even when E of the row does not equal "A"), return to SUM the AVERAGE of F (where E="A", even average in the zeros): 9*(18/5) [missing red highlighting in row 25]. SUM will also get the average of G (where E="A") for every row of F=0 if the same row of G<>0 (regardless of Es value): 1*(73/5). For each row with E=0 & F=0 & G<>0 then SUM the AVERAGE of G (where E="A") that number of times. All that divided by 3 (even if all else was correct, this would assume the same number of zeros per column). (9*(18/5) + 73/5)/3 = 15.67
– Ted D.
Feb 15 at 22:21
1
1
Write your concern, why down voted, help me to make my viewpoint clear !!
– Rajesh S
Mar 1 at 8:29
Write your concern, why down voted, help me to make my viewpoint clear !!
– Rajesh S
Mar 1 at 8:29
You may have been down voted because of my comment. Your result 15.67 is calculated as outlined in my comment 15.67, which is completely wrong and you never bothered to fix it. The formula you use does not ignore zeros as stipulated in the OP. By dividing by three, your formula is weighting every column equally, so even if the zeros had been ignored, if there were a different number of zeros in one column, this would not be right. The formula you use sums the average from the first column multiple times and never averages the third column.
– Ted D.
Mar 1 at 14:53
You may have been down voted because of my comment. Your result 15.67 is calculated as outlined in my comment 15.67, which is completely wrong and you never bothered to fix it. The formula you use does not ignore zeros as stipulated in the OP. By dividing by three, your formula is weighting every column equally, so even if the zeros had been ignored, if there were a different number of zeros in one column, this would not be right. The formula you use sums the average from the first column multiple times and never averages the third column.
– Ted D.
Mar 1 at 14:53
1
1
@TedD.,, thanks for the observation,, do you have any suggestion that where my Formula need correction?
– Rajesh S
Mar 2 at 6:37
@TedD.,, thanks for the observation,, do you have any suggestion that where my Formula need correction?
– Rajesh S
Mar 2 at 6:37
1
1
@TedD., thanks for the time you have invested on the issue, what I do believe that you must add an alternative Formula which exactly meets OP requirements along with the Analysis as a NEW ANSWER,, instead of edit my post,, will help the OP and the community also.
– Rajesh S
Mar 3 at 4:59
@TedD., thanks for the time you have invested on the issue, what I do believe that you must add an alternative Formula which exactly meets OP requirements along with the Analysis as a NEW ANSWER,, instead of edit my post,, will help the OP and the community also.
– Rajesh S
Mar 3 at 4:59
|
show 3 more comments
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1402856%2faverage-calculation-for-multiple-non-adjacent-columns-with-criteria%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown