Sum with multiple criteria

mnunan

New Member
Joined
Apr 1, 2011
Messages
18
Hi

Can anyone help with the following formula please, I need to:

Sum the cells in column G where the date in column D is between the dates specified in cells B2 and C2 (in a different worksheet) and where the text in column B is "LHR" and where the the cells in column L are not blank.

Column D = date
Column G = currency
Columns B & C in a different worksheet = date
Column L = text

Thanks very much :biggrin:
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Hi

Can anyone help with the following formula please, I need to:

Sum the cells in column G where the date in column D is between the dates specified in cells B2 and C2 (in a different worksheet) and where the text in column B is "LHR" and where the the cells in column L are not blank.

Column D = date
Column G = currency
Columns B & C in a different worksheet = date
Column L = text

Thanks very much :biggrin:
What version of Excel are you using?
 
Upvote 0
Hi

Can anyone help with the following formula please, I need to:

Sum the cells in column G where the date in column D is between the dates specified in cells B2 and C2 (in a different worksheet) and where the text in column B is "LHR" and where the the cells in column L are not blank.

Column D = date
Column G = currency
Columns B & C in a different worksheet = date
Column L = text

Thanks very much :biggrin:

Try on the sheet housing the relevant ranges...
Code:
=SUMPRODUCT(
    $G$2:$G$400,
    --($D$2:$D$400>=Sheet2!B2),
    --($D$2:$D$400<=Sheet2!C2),
    --($L$2:$L$400="LHR"))

If you are on Excel 2007 or later, try SUMIFS function...
 
Upvote 0
Sorry I always forget that! Excel 2007 :biggrin:
OK, try this...

Use cells to hold the criteria:
  • Sheet2 B2 = lower date boundary
  • Sheet2 C2 = upper date boundary
  • A2 = LHR
Then:

=SUMIFS(G2:G100,D2:D100,">="&Sheet2!B2,D2:D100,"<="&Sheet2!C2,L2:L100,A2)
 
Upvote 0
As pointed out in post #3, you can try a SumIfs formula on 2007 and later...
Code:
=SUMIFS(
    $G$2:$G$400,
    $D$2:$D$400,">="&Sheet2!B2,
    $D$2:$D$400,"<="&Sheet2!C2,
    $L$2:$L$400="LHR")
Looks like you have a syntax error in that formula.

Try it like this:

=SUMIFS($G$2:$G$400,$D$2:$D$400,">="&Sheet2!B2,$D$2:$D$400,"<="&Sheet2!C2,$L$2:$L$400,"LHR")
 
Upvote 0
Hi

I have tried both the sumproduct and sumifs, sumproduct returns 0 and sumifs says too few arguments. Also, the last part of the formula you have suggested should be referencing column B not L and there doesn't seem to be an argument to check if column L is not empty?

Thanks again
 
Upvote 0
Looks like you have a syntax error in that formula.

Try it like this:

=SUMIFS($G$2:$G$400,$D$2:$D$400,">="&Sheet2!B2,$D$2:$D$400,"<="&Sheet2!C2,$L$2:$L$400,"LHR")

Thanks T Valko, your correction worked, however can you help me with also checking to see if column L (L should have been B in the above formula) contains any text, I don't want the corresponding cell in column G summed if column L doesn't contain anything.

Thanks :confused:
 
Upvote 0
Thanks T Valko, your correction worked, however can you help me with also checking to see if column L (L should have been B in the above formula) contains any text, I don't want the corresponding cell in column G summed if column L doesn't contain anything.

Thanks :confused:
=SUMIFS($G$2:$G$400,$D$2:$D$400,">="&Sheet2!B2,$D$2:$D$400,"<="&Sheet2!C2,$L$2:$L$400,"LHR")
Are you saying that ...$L$2:$L$400,"LHR"... should be ...$B$2:$B$400,"LHR"... ?

Maybe this:

=SUMIFS($G$2:$G$400,$D$2:$D$400,">="&Sheet2!B2,$D$2:$D$400,"<="&Sheet2!C2,$B$2:$B$400,"LHR",$L$2:$L$400,"?*")
 
Upvote 0

Forum statistics

Threads
1,224,608
Messages
6,179,872
Members
452,949
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top