Jan 25 2020 10:54 PM
CountIF
Using your example:
In column F next to each name you could use:
As a standard formula: =sumproduct(1/CountIf(range,range)
For example:
Pearl =SUMPRODUCT(1/COUNTIF(B6:B10,B6:B10))
Horntree =SUMPRODUCT(1/COUNTIF(B11:B11,B11:B11))
Red Sky =SUMPRODUCT(1/COUNTIF(B12:B18,B12:B18))
Miranda =SUMPRODUCT(1/COUNTIF(B19:B25,B19:B25))
Mexicana =SUMPRODUCT(1/COUNTIF(B22:B22,B22:B22))
Parva =SUMPRODUCT(1/COUNTIF(B27:B31,B27:B31))
As an array =sum(1/CountIf(range,range))
(remember after typing the below formula hit CTRL+SHIFT+ENTER, this will add curly brackets before and after automatically.
For example:
Pearl =sum(1/COUNTIF(B6:B10,B6:B10))
Horntree =sum(1/COUNTIF(B11:B11,B11:B11))
Red Sky =sum(1/COUNTIF(B12:B18,B12:B18))
Miranda =sum(1/COUNTIF(B19:B25,B19:B25))
Mexicana =sum(1/COUNTIF(B22:B22,B22:B22))
Parva =sum(1/COUNTIF(B27:B31,B27:B31))
each of the above will look like the following after hitting CTRL+SHIFT+ENTER
Pearl {=sum(1/COUNTIF(B6:B10,B6:B10))}
Horntree {=sum(1/COUNTIF(B11:B11,B11:B11))}
Red Sky {=sum(1/COUNTIF(B12:B18,B12:B18))}
Miranda {=sum(1/COUNTIF(B19:B25,B19:B25))}
Mexicana {=sum(1/COUNTIF(B22:B22,B22:B22))}
Parva {=sum(1/COUNTIF(B27:B31,B27:B31))}
For more information and examples:
Jan 26 2020 12:02 AM - edited Jan 26 2020 12:10 AM
SolutionAlternatively in F5 and copy down.
=SUMPRODUCT(IFERROR(1/(E5=$A$2:$A$33),""),1/COUNTIF($B$2:$B$33,$B$2:$B$33))
Depending on your Excel version you may have to press Ctrl-Shift-Return to enter it. Note that your list doesn't have to be sorted by commodity. It will always count the number of boxes that each commodity has in storage.
Jan 26 2020 01:05 AM
The formula you have just suggested works but I have to manually select the specific range of the commodity on the left i.e. in column E.
Jan 26 2020 01:47 AM
For the record, an Office 365 solution:
The total boxes is given by
= ROWS( UNIQUE( data ) )
whilst the number for each given commodity is
= ROWS( UNIQUE( FILTER( data, Commodity=@DistinctCommodity ) ) )
Jan 26 2020 12:02 AM - edited Jan 26 2020 12:10 AM
SolutionAlternatively in F5 and copy down.
=SUMPRODUCT(IFERROR(1/(E5=$A$2:$A$33),""),1/COUNTIF($B$2:$B$33,$B$2:$B$33))
Depending on your Excel version you may have to press Ctrl-Shift-Return to enter it. Note that your list doesn't have to be sorted by commodity. It will always count the number of boxes that each commodity has in storage.