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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
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)
 
Upvote 0
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.
 
Upvote 0
Somewhat cleaned up...

=SUMPRODUCT(--(ReferenceRange=Reference),--(YearRange=Year),--(PeriodRange>=StartVal),--(PeriodRange<=EndVal),ConsumptionRange)
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,421
Members
448,961
Latest member
nzskater

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