View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Harlan Grove Harlan Grove is offline
external usenet poster
 
Posts: 733
Default Count formel. Dont like the new year

svemor wrote...
....
=COUNT(IF(Data!$B$2:$B$65536=Statistikk!B$2;IF(Da ta!$G$2:$H$655360;
IF(Data!$F$2:$F$65536=$A3;IF(YEAR(INT(Data!$I$2:$ I$65536))=2007;
IF(INT(Data!$E$2:$E$65536)<=INT(Data!$I$2:$I$6553 6);Data!$G$2:$H$65536))))))

Data in B column = name of saleperson
Data in G column = Sale amount
Data in F column = weeknumber
Data in I column = Sale date
Data in E column = Date of contact from saleperson
Data in G/H column = Sale amount


Difficult to imagine that E# I# for any # in 2..65536 shouldn't have
generated an error upon entry. Since that's fundamental, I'd put the
array formula

=AND(Data!$E$2:$E$65536<=Data!$I$2:$I$65536)

in another cell (call it VALID), then wrap the replacement for the
formula above inside

=IF(VALID;...;"Invalid")

As for the formula above, easier to use

=IF(VALID;
SUMPRODUCT((Data!$B$2:$B$65536=Statistikk!B$2)*(Da ta!$G$2:$H$655360)
*(Data!$F$2:$F$65536=$A3)*(YEAR(Data!$I$2:$I$65536 )=2007)*Data!$G$2:$H$65536;
"Invalid")

Note that I deleted all INT calls. These are date values, and as long
as Excel displays them as dates, they're positive numbers. As positive
numbers, YEAR(INT(x)) is *ALWAYS* equal to YEAR(x). The INT calls serve
no clear purpose. As for comparing columns E and I, calling INT would
exclude all sales made on the same day as the date of contact by the
salesperson, but would include sales made, say, 2 minutes after
midnight when the date and time of contact were, say, 5 minutes before
that midnight. I'm guessing that's not what you intended.