Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default SUM 2 cells only if there is a value in both

I want to SUM two cells in an Excel worksheet but only if there is a value in
both cells. For each month of the year I want to show total minutes (B32:43)
less minutes used (D32:43). The answer will be in (E32:43). However if I use
the simple SUM function =SUM(B32-D32) I get the total minutes in Column E if
there is nothing in column D. I've looked at SUMIF but cannot figure out how
to use it for this purpose. Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default SUM 2 cells only if there is a value in both

Hi,

You don'r need sum to subtract a number from another, try this

=IF(COUNT(B32,D32)=2,B32-D32,"")


Mike

"milt" wrote:

I want to SUM two cells in an Excel worksheet but only if there is a value in
both cells. For each month of the year I want to show total minutes (B32:43)
less minutes used (D32:43). The answer will be in (E32:43). However if I use
the simple SUM function =SUM(B32-D32) I get the total minutes in Column E if
there is nothing in column D. I've looked at SUMIF but cannot figure out how
to use it for this purpose. Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 915
Default SUM 2 cells only if there is a value in both

milt wrote:
I want to SUM two cells in an Excel worksheet but only if there is a value in
both cells. For each month of the year I want to show total minutes (B32:43)
less minutes used (D32:43). The answer will be in (E32:43). However if I use
the simple SUM function =SUM(B32-D32) I get the total minutes in Column E if
there is nothing in column D. I've looked at SUMIF but cannot figure out how
to use it for this purpose. Thanks for your help.


In E32:
=IF(D32="","",B32-D32)

Fill down.
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default SUM 2 cells only if there is a value in both

To start with, you haven't actually used the SUM function. You have given
the function only one argument, and you haven't given it any other arguments
to sum to the first argument. If you want B32-D32 the formula is =B32-D32,
and it doesn't need the SUM function. [If you want to know how the SUM
function works, look it up in Excel help.]

If you want to calculate this only if there is data in both cells, you can
use =IF(COUNT(B32,D32)=2,B32-D32,"")
--
David Biddulph

milt wrote:
I want to SUM two cells in an Excel worksheet but only if there is a
value in both cells. For each month of the year I want to show total
minutes (B32:43) less minutes used (D32:43). The answer will be in
(E32:43). However if I use the simple SUM function =SUM(B32-D32) I
get the total minutes in Column E if there is nothing in column D.
I've looked at SUMIF but cannot figure out how to use it for this
purpose. Thanks for your help.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel: match two cells in one sheet to two cells in another and return a third cells value Spence Excel Worksheet Functions 3 February 13th 11 05:33 AM
Cells won't change font color or show hi-lighted cells in document ROBIN Excel Discussion (Misc queries) 1 March 27th 08 09:39 PM
display a range of cells editible cells based on matching date Miki Excel Worksheet Functions 0 October 10th 07 03:27 PM
Setting of input cells as blue font and formula cells as black fon Sunnyskies Excel Discussion (Misc queries) 2 May 14th 07 05:27 PM
trying to create an (almost) circular formula between cells and data validated cells with lists KR Excel Worksheet Functions 0 May 12th 05 07:21 PM


All times are GMT +1. The time now is 02:20 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"