SUMIF

G

Gary Thomson

I have 3 sets of data on the same sheet:

All 3 sets have the same first 4 columns (i.e. Unit, 50%,
100% and 130%).


The first range of data is A1:p10, which I shall
call "DATES":

UNAVAILABLE
A B C D E F G...
1 Unit 50% 100% 130% 1-Feb 2-Feb 3-Feb
2 Maths £35 £70 £91 x x x
3 English £30 £60 £78 x x
4 Music £25 £50 £65 x
5 Science £20 £40 £52
6 P.E. £15 £30 £39
.. .
.. .
.. .


The second range is in A21:p30, which I shall call "USAGE":

USAGE
A B C D E F G
21 Unit 50% 100% 130% 1-Feb 2-Feb 3-Feb
22 Maths £35 £70 £91 y
23 English £30 £60 £78 y
24 Music £25 £50 £65
25 Science £20 £40 £52 y
26 P.E. £15 £30 £39
.. .
.. .
.. .


The third range is in A41:p50, which I shall
call "CONSECUTIVE DAYS GREATER THAN 5?":


CONSECUTIVE DAYS GREATER THAN 5?
A B C D E F G
41 Unit 50% 100% 130% 1-Feb 2-Feb 3-Feb
42 Maths £35 £70 £91 1 2 3
43 English £30 £60 £78 1 2
44 Music £25 £50 £65 5
45 Science £20 £40 £52
46 P.E. £15 £30 £39
.. .
.. .
.. .




I want a formula that will sum the amounts attributed to
each date based on the combination of "x"'s (in
the "UNAVAILABLE" range), "y"'s (in the "USAGE" range),
and number of days Unavailable (in the CONSECUTIVE DAYS
GREATER THAN 5?" table).


FOR each cell from E2 to E10 in the "UNAVAILABLE" range

IF the required cell contains an "x":

THEN IF the corresponding cell in the "USAGE" range
contains a "y" then add on the value in the "B" column, but

IF the corresponding cell in the "USAGE" range does NOT
contain a "y":

THEN IF the corresponding cell in the "CONSECUTIVE DAYS
GREATER THAN 5?" range is >5, add on the value in the "D"
column, otherwise add on the value in the "C" column;

IF in the "UNAVAILABLE" range, the required cell does not
contain an "x":

THEN IF the corresponding cell in the USAGE range contains
a "y", then add on the value in the "B" column, otherwise
add on the value in the "C" column.

Can this be done using some sort of SUMIF or SUMPRODUCT
formula?

I will be interested to see what you can make of this.

If I have not explained myself well, just let me know and
I'll try to make it clearer.

Thanx
 
J

Jerry W. Lewis

Not at all sure that I understood your question, but my best guess is

=SUMPRODUCT((E2:G6="x")*(E22:G26="y")*B2:B6)
+SUMPRODUCT((E2:G6="x")*(E22:G26<>"y")*(E42:G46<=5)*C2:C6)
+SUMPRODUCT((E2:G6="x")*(E22:G26<>"y")*(E42:G46>5)*D2:D6)
+SUMPRODUCT((E2:G6<>"x")*(E22:G26="y")*B2:B6)
+SUMPRODUCT((E2:G6<>"x")*(E22:G26<>"y")*C2:C6)

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top