View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bernard Liengme[_2_] Bernard Liengme[_2_] is offline
external usenet poster
 
Posts: 563
Default Sumif Format Equals

Excel stores dates as serial numbers. The date 1/1/2009 has value 39814.
So if each of your money values are below that value, you could use
=SUMIF(A:A,"<39814")

Alternatively you could use a helper column. In B1 (or some other column far
to the right, and maybe hidden) enter =CELL("format",A1), copy down the
column. Cells with dates will have formats of Dn (where n is a digit) while
cells formatted to show 2 decimal places will have F2, while those with
currency format will have C2. Very odd: a long date such as 1 January 2010
seems to have format G (general) - I am using Excel 2010 beta

To sum currency formatted cell: =SUMIF(B1:B100,"C2",A1:A100)

Note: the CELL function is not volatile so if you reformat a cell the
formula will not update until the worksheet is next recalculated. You can
force this with F9.

If the helper column is not acceptable, maybe someone with give you a VBA
solution.
best wishes
--
Bernard Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme

"Starbuck82" wrote in message
...
I have both dates and currency in the same column. How do I sum the
column
based on format of the cell? Specifically, how do I sumif only the cells
containing currency?