View Single Post
 
Old 02-01-2011, 10:42 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

To get the sum of column D (hours) where column B (account number) is 9, you can use this formula in cell D12:
Code:
=SUMIF(B4:B9,9,D4:D9)
To get the sum of column E (amount) where column B (account number) is 9, you can use this formula in cell E12:
Code:
=SUMIF(B4:B9,9,E4:E9)

To get the sum of column D (hours) where column B (account number) is not equal to 9, you could use either of these formulas:
Code:
=SUMIF(B4:B9,"<>9",D4:D9)
 
=D14-D12

To get the sum of column E (hours) where column B (account number) is not equal to 9, you could use either of these formulas:
Code:
=SUMIF(B4:B9,"<>9",E4:E9)
 
=E14-E12
Instead of typing the constant "9" in the formula, you could put it in a cell and reference that cell. This is generally considered to be better practice: if you change cell C12 to 9 instead of Acct 9 Total then the formulas would be:
Code:
=SUMIF(B4:B9,C12,D4:D9)
=SUMIF(B4:B9,C12,E4:E9)
=SUMIF(B4:B9,"<>"&C12,D4:D9)
=SUMIF(B4:B9,"<>"&C12,E4:E9)
etc...
Reply With Quote