LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Pete_UK
 
Posts: n/a
Default How do I add a column of cells, but IF a row has (), subtract?

By putting the parentheses around the time figure, you will probably be
converting it into a text value, so it will not be considered in the
normal summing. I think the way around this would be to use a helper
column to indicate if the time is to be subtracted or added (you can
use conditional format to turn the cell red if the cell next to it
contains "-" or whatever symbol you choose to indicate subtraction. I
put this data in cells A1 to B6:

0:08:00
0:06:00
0:03:00
0:09:00 -
0:05:00
0:07:30 -

Then in another cell I put this array formula*:

=SUM(IF(B1:B6="-",-A1:A6,A1:A6))

* As this is an array formula, when you have typed it in (or when you
subsequently edit it) you must use CTRL-SHIFT-ENTER instead of ENTER.
If you do this correctly then Excel will wrap curly braces { } around
the formula - you must not type these yourself.

The value I got was 0:05:30, which is correct for this data.

Hope this helps.

Pete



 
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
checking that cells have a value before the workbook will close kcdonaldson Excel Worksheet Functions 8 December 5th 05 04:57 PM
Macro Help: Concatenate Populated Cells in Column A TJM Excel Discussion (Misc queries) 3 June 11th 05 11:25 AM
Count Position of Filtered TEXT cells in a column Sam via OfficeKB.com Excel Worksheet Functions 8 May 18th 05 04:23 AM
Return Count for LAST NonBlank Cell in each Row Sam via OfficeKB.com Excel Worksheet Functions 12 April 17th 05 10:36 PM
how can i fill blank cells in column with abc while the right col. khurram saddique Excel Discussion (Misc queries) 2 February 12th 05 03:25 PM


All times are GMT +1. The time now is 05:50 AM.

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

About Us

"It's about Microsoft Excel"