SUMIF

dcartwright

New Member
Joined
Feb 22, 2006
Messages
31
Good afternoon

I would appreciate some help with a problem that I have.

Below is a simplified version of a spreadsheet I have.
What I am trying to do is this. I want a formula writing that looks up a "Reference Number" in sheet 2 of my spreadsheet. I then want it to add up from Sheet 1 any any values from column D (Consumption Kwh) where column A (Reference Number) is the value from Sheet 1 that I have specified AND where Shhet 1 column B (Year) = 2005-06 AND where Sheet 1 column C (Period)is between 3 and 8

Thanks in advance

Dave
Book1
ABCD
1ReferenceNumberYearPeriodConsumptionKwh
2187366932005-0633,893.00
3187366932005-0621,722.00
4497343452004-054166,442.00
5187366932005-06727,458.00
6927366972005-06623,715.00
7111136602005-061049,717.00
8187366932005-06514,116.00
9187366932004-0578,723.00
Sheet1
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
Not very pretty, but this seems to be working for me (this is assuming the formula will be added to Sheet1--change the references if/where needed):

=SUMPRODUCT(--($A$2:$A$9=Sheet2!$A$1)*($B$2:$B$9="2005-06")*($C$2:$C$9>=3)*($C$2:$C$9<=8),$D$2:$D$9)
 

dcartwright

New Member
Joined
Feb 22, 2006
Messages
31
I can't quite get that formula to work.

In your first section you wrote "=SUMPRODUCT(--($A$2:$A$9=Sheet2!$A$1)

Should that not be sheet1?

My actual sheet that I am writing the formula in is called "Gas Summary" this has a column D which holds the "Reference number" my sheet that the formula looks in is called "AutoLoaded Gas" this sheet holds my reference numbers, years, period's and consumption.

Your formula does not seem to be quite right unless I am entering it wrong.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
Somewhat cleaned up...

=SUMPRODUCT(--(ReferenceRange=Reference),--(YearRange=Year),--(PeriodRange>=StartVal),--(PeriodRange<=EndVal),ConsumptionRange)
 

Von Pookie

MrExcel MVP
Joined
Feb 17, 2002
Messages
13,686
Like I said:
(this is assuming the formula will be added to Sheet1--change the references if/where needed):

In short, the formula is being placed on Sheet1, where the data lies and as such does not need to have the Sheet referenced. The value you want to look for is in Sheet2, cell A1, which is why it is written the way it is. Remember, this is all based off of the sample you gave in the first post as that is all there is (was) to work from.
 

dcartwright

New Member
Joined
Feb 22, 2006
Messages
31
Many Thanks for your help.

I tried your formula again this morning and it has worked a treat. :biggrin:

Regards

Dave
 

Forum statistics

Threads
1,141,624
Messages
5,707,466
Members
421,510
Latest member
haroonstr

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
Top