Search code examples
excelcountnumbersdistinct

Sum the quantity for all duplicates of a distinct value


enter image description here

Hi everyone,

I'm trying to sum the quantity of individuals for all the duplicates of a distinct location.

I've counted the number of duplicates each of those distinct values has. Now I need that number to reflect the sum of the quantity. For example, where there are 4 duplicates of a distinct location, I need the last column to show the number 13 on the 5th row.

Quantity |   Latitude     | Longitude   | Distinct locat° |  N° of that locat° | Quantity at 1 location            
1        |   34°03'59.7"S |23°22'35.2"E | Distinct        |          1         |    ?                      
9        |   34°04'32.9"S |23°22'20.0"E |                 |                    |    NA
1        |   34°04'32.9"S |23°22'20.0"E |                 |                    |    NA
2        |   34°04'32.9"S |23°22'20.0"E |                 |                    |    NA
1        |   34°04'32.9"S |23°22'20.0"E | Distinct        |          4         |    ? (will be 13)          
1        |   34°10'60.0"S |22°09'27.5"E |                 |                    |    NA
5        |   34°10'60.0"S |22°09'27.5"E |                 |                    |    NA
1        |   34°10'60.0"S |22°09'27.5"E |                 |                    |    NA
2        |   34°10'60.0"S |22°09'27.5"E |                 |                    |    NA
1        |   34°10'60.0"S |22°09'27.5"E | Distinct        |          5         |    ?          
1        |   33°42'47.1"S |26°37'05.6"E | Distinct        |          1         |    ?      

The above example is only a few rows but I have over 2900 rows and 390 distinct values. Some of them have 20 duplicates with various quantities, so I need a formula.

Does anyone know how to do that?

Thanks in advance.


Solution

  • enter image description here

    =IF(D2="Distinct";SUMIFS($A$2:$A$12;$B$2:$B$12;B2;$C$2:$C$12;C2);"NA")