# How to sum a value range with more than one criteria

I have a matrix with a column \”montant\” and two columns \”TypeP\” and \”P\” that I use as criteria.

I want to sum \”Montant\” for only one combinaison of the two criteria.

Thanks for your help.

vb67 Answered question April 4, 2021

Hi vb67!

1. Let there are three matrices:

**SD**{*C*:Fields[I:Value, TypeP, P], *C*:Recs[I:Rc1..Rc10]} is some Source Data,

**SmlCrt**{*C*:Criterium[I:TypeP, P]} is Sampling Criteria,

**Report**{*C*:CalcVar[I:Calc1..Calc3]} are Results of three formulas;

and

2. Let the **TypeP** criterion takes values from the range [C1,C2,C3]; the criterion **P** takes values from the range [E1,E2,E3].

Then the sum of the values chosen by the two criteria (**TypeP** & **P**) can be obtained by one of the three formulas (see below).

*

*

Logic:

*

*

Good luck

S A U Answered question April 2, 2021