Excel: Calculating a SUM+IF on a Discontinuous SelectionID: Q79138
|
To calculate a SUM(IF()) on a discontiguous range, separate IF functions must be placed in the SUM function as arguments.
For example, assume that we want to return the sum of all values that equal
10 in the range A1:A12 and in G16:G57. The following formula, entered as an
array, will work correctly on up to 14 noncontiguous areas:
{=SUM(IF(A1:A12=10,1,0),IF(G16:G57=10,1,0))}
{=SUM(IF((A1:A12,G16:G57)=10,1,0))} returns a #VALUE!, and
{=SUM(IF(A1:A12,G16:G57=10,1))} returns a #N/A.
=COUNTIF(A1:A12,10)+COUNTIF(G16:G57,10)
"Microsoft Excel Function Reference," version 3.0, pages 231-232
Additional query words: 2.10 2.1 2.10c 2.1c 2.10d 2.1d 2.20 2.21 4.0 5.0
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: March 23, 1999