Please can someone help me with the following?
I'm trying to work out the sum of data in column E based when column B of the row = 1 and so on.
I thought I could do this with a lookup or sumif, but I've tried for two days to find something.
The best I could come up with (to show I have at least tried) was to create extra columns outside of the table I'm working with and use if functions to check wether column B = 1 or not then summing up that column, but it's very messy.
eg:
in G2
=IF($B2=1,$E2,"")
Then
=sum(G1:G10)
Can anyone suggest anything better please?
Thanks in advance,
Tom
Hi,
Try
=SUMPRODUCT((B1:B10=1)*(G1:G10))
Sarcasm - because beating the **** out of someone is illegal.
Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.
Moved to Excel Worksheet Functions forum
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
Bingo!
Thanks so much! You've REALLY helped me out!
I've never used SUMPRODUCT() before either.
Cheers,
Tom
I think a standard SUMIF should suffice, no ?
=SUMIF(B1:B10,1,E1:E10)
SUMPRODUCTS generally only required if you have 2+ tests (and run pre XL2007) and/or are obliged to manipulate the datasets without use of helper cells.
Last edited by DonkeyOte; 05-14-2009 at 12:20 PM.
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
Indeed it would.
I appear to be suffering with sumproduct blindness.
DonkeyOte...
Do you mean: SUMPRODUCTS generally only required if you have 2+ tests?
Microsoft MVP - Excel
Where there is a will there are many ways. Pick One!
Please read the Forum Rules
If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below
Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.
Preferred Charities: Lupus Canada and Sick Kids Foundation.
Feel Free to Donate if you want to, for the assistance you received today.
sweep, SUMPRODUCT is my favourite function (how sad that I have a favourite!) but I;ve learnt the hard way to use in moderation and only when necessary ;-)
NBVC, yep - I meant 2+ ... to avoid confusion have edited the post ... thanks !
My Recommended Reading:
Volatility
Sumproduct & Arrays
Pivot Intro
Email from XL - VBA & Outlook VBA
Function Dictionary & Function Translations
Dynamic Named Ranges
It's also recently become my favourite. I used to love OFFSET, but you made me realise it's a naughty function.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks