View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Coderre
 
Posts: n/a
Default formula to add dates.

In case window wrap impacted the display, there are no spaces in the formula
I posted. You can probably just copy it right from the window into Excel and
delete any carriage returns that break up the formula.

=SUMPRODUCT(IF(ISNUMBER(SEARCH("-",A3:A50)),--MID(A3:A50,SEARCH("-",A3:A50)+1,255))-IF(ISNUMBER(SEARCH("-",A3:A50)),--LEFT(A3:A50,SEARCH("-",A3:A50)-1)))+COUNTIF(A3:A50,"1-*")

(Don't forget to Ctrl+Shift+Enter)

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"S S" wrote:

I think I have copied and entered ok but it is returning an answer of 1


"Ron Coderre" wrote in message
...
See if this array formula works for you:

A51:
=SUMPRODUCT(IF(ISNUMBER(SEARCH("-",A3:A50)),--MID(A3:A50,SEARCH("-",A3:A50)+1,255))-IF(ISNUMBER(SEARCH("-",A3:A50)),--LEFT(A3:A50,SEARCH("-",A3:A50)-1)))+COUNTIF(A3:A50,"1-*")

Note: To commit array formulas, hold down [Ctrl] and [Shift] when you
press
[Enter].

Does that help?

***********
Regards,
Ron

XL2002, WinXP-Pro


"S S" wrote:

Looking for a formula to add the figures below.



Cells are in column A row 3 to 50 Example.



A3 1-14 (this represents dates 1st to 14th)

A4 (blank ,no dates)

A5 16-30 (this represents dates 16th to 30th)

A5 (blank,no dates)

A6 (blank,no dates)

A7 2-9 (this represents dates 2nd to 9th)



And so on until row 50

I am looking for a formula that will work out that A3 is 14 days, A5 is
14
days, A7 is 7 days. And add them to give a total of 35 days in the cell
I
put the formula. The dates will obviously vary from cell to cell and some
will be blank.



thanks