Average If - Different Cells

JustOneQuestion

New Member
Joined
Jul 5, 2016
Messages
19
Hi all,

I am trying to average 2 cells (k35 and m35) if the cell value is greater than 0. Those 2 cells are an average of the column. I want the equation to average both cells if there is a value in the cells, if not, just display one or the other cell value.

The issue that I am running into is if there is not a value in m35 (or k35) it still is averaging, so it is showing an incorrect value because it is dividing the number by 2.

Here is the old formula that I have been using, but I added a column in the middle, so I can no longer use the K35:L35.

=IFERROR(AVERAGEIF(K35:L35,">0"),0)

Any thoughts?

Thank you!
 
Sorry about that. I just copied your example and left the numbers in there.

here is the corrected version with the formula you provided in Q35

KLMNQ

<tbody>
[TD="align: center"]35[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"]5[/TD]

[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>

 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
When you say no value in K or M, do you have a 0 (zero) in K or M???

k or m is blank. No values in it.

Sorry about that. I just copied your example and left the numbers in there.

here is the corrected version with the formula you provided in Q35

K
L
M
N
Q

<tbody>
[TD="align: center"]35
[/TD]
[TD="align: right"]10
[/TD]
[TD="align: right"][/TD]
[TD="align: right"]0[/TD]
[TD="align: right"][/TD]
[TD="align: right"]5
[/TD]

[TD="align: center"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]
[TD="align: right"][/TD]

</tbody>


So you DO have a value in M35! The 0 (zero), will post right back with updated formula.
 
Last edited:
Upvote 0
Ok, this will work whether you have 0 value in the cells Or if they're Blank, let me know if it works.


Book1
KLMNO
35343.5
36303
3700
38044
3910010
4033
4144
42
431010
441010
Sheet15
Cell Formulas
RangeFormula
O35=IF(AND(K35=0,M35=0),"",IF(OR(K35=0,M35=0),MAX(K35,M35),AVERAGE(K35,M35)))
 
Upvote 0
You're welcome.

FYI, having a 0 (zero) in a cell does Not mean there's no value in the cell (Nor does it mean the cell is Blank), a 0 is a Valid value for mathematical purposes and will be included as such.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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