P
Peter Nelson
I am trying to calculate some diversity indices from a fairly large database
(nearly 47000 rows). The data are set up as follows
A B C
sample species # ind
1 a 83
1 b 2
1 e 1
2 b 12
2 c 4
3 a 1200
3 c 16
3 d 1
3 e 5
where "# ind" refers to the number of individuals for each species.
I need to calculate (among other things) the total sum of all individuals
for each sample (e.g. sample 1: 83+2+1=86).
How can I sum only those cells in the '# ind' column belonging to a given
sample? As far as I can determine, I can't use the conditional sum features.
It's easy enough to identify the start of each sample (=(A1=A2) is FALSE for
the first row of each sample and true for the subsequent rows of a given
sample, but coming up with a way of 'halting' the summation in col D with
each new FALSE has me stumped.
Thanks in advance for your help. Pete
(nearly 47000 rows). The data are set up as follows
A B C
sample species # ind
1 a 83
1 b 2
1 e 1
2 b 12
2 c 4
3 a 1200
3 c 16
3 d 1
3 e 5
where "# ind" refers to the number of individuals for each species.
I need to calculate (among other things) the total sum of all individuals
for each sample (e.g. sample 1: 83+2+1=86).
How can I sum only those cells in the '# ind' column belonging to a given
sample? As far as I can determine, I can't use the conditional sum features.
It's easy enough to identify the start of each sample (=(A1=A2) is FALSE for
the first row of each sample and true for the subsequent rows of a given
sample, but coming up with a way of 'halting' the summation in col D with
each new FALSE has me stumped.
Thanks in advance for your help. Pete