View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Sub-Totals within dynamic times

Worksheet function?

=SUMPRODUCT((A1:A100="PD")*(B1:B100=4)*(B1:B100<= 7)*(C1:C100="Sampling"))

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Simon Thwaites" wrote in message
...
I have 5000 rows in data in the following format with 6 positions, 16

weeks and 12 activities:

Position Week Activity Hours
PD 1 Sampling 2
AD 2 PM 3
PD 3 Analysis 2
AD 4 Analysis 1
SPM 5 PM 2
SPM 2 PM 4.5
PD 3 Sampling 6
RE 2 Analysis 5.5
RE 2 PM 8.4
SPM 5 Analysis 3
SPM 5 Analysis 4
PD 3 Analysis 3
AD 2 PM 3
AD 1 Sampling 3
PD 1 Sampling 3
PD 1 PM 1
AD 2 Analysis 4
AD 2 PM 9
AD 2 Analysis 11

I need to write a macro which can work out, for example, the amount of

time spent by PDs on Sampling between
week 4 and 7.
Currently I have loads of DSums stored and it works but highly laborious.
Can I write a macro which loops through cells and for example dumps

sub-totals in cells,
for AD time spent on Sampling
PD time spent on Analysis within a particular timescale etc.etc.