Calculation based on values in two adjacent cells.

network_engineer

New Member
Joined
May 14, 2011
Messages
37
Hello all,

Wondering if somebody here would help me with this:

How would I calculate the sum in a cell, if I want the value to be calculated ONLY if two values in the respective rows are matching?

E.g.
D17="High"; G17="Y"; E17=2
D18="High"; G18="N"; E18=2
D19="High"; G19="Y"; E19=2
D20="Low"; G20="N"; E20=2

__________________E21=4

So, in other words, the values in blue (E18 and E20) are ignored and not taken into calculation.

Thanks a lot for any help.

Kind regards.
Ben
 
Hi all,

It returns me a value of zero (0). Could somebody tell me what is wrong with this? (I changed a few values as I updated my workbook)

Code:
=SUMPRODUCT((D17:D65536="High");(G17:G65536="Non-Veg");(E17:E65536))
I also tried the same thing with SUMIFS, but I am getting an error:
Code:
=SUMIFS(E17:E65536;D17:D65536="High";G17:G65536="Non-Veg")
Kind regards,
Ben

Try to stipulate the conditions of a desired calculation though...

You need to modify the syntax in the expressions...

1] Just enter:

=SUMIFS(E17:E65536;D17:D65536;"High";G17:G65536;"Non-Veg")

2] Just enter:

=SUMPRODUCT(--(D17:D65536="High");--(G17:G65536="Non-Veg");(E17:E65536))

3] Also: Control+shift+enter...

=SUM(IF(D17:D65536="High";IF(G17:G65536="Non-Veg";E17:E65536)))
 
Upvote 0

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

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