Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
c1 Date Sold
d1 Date Acquired e1 Proceeds f1 Cost Basis To determine if the capital gain/loss is short-term, I can use this formula: IF(C1-D1<=365,C1-D1,0); however that won't work for a leap year. A short-term gain/loss is one year or less. What forumula would I use? Thanks, -- Howard |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
this is a puzzler. Difficulty with the below is does not account for cases
where D1 is a leap year and the end date is past February. We can get there using lots of if statements, but isn't there a less obfuscated way than that? Also, technically, we'd have to account for years such as 1900, 2100, et. al. that are not leap years... "Jim May" wrote: in article , Howard at wrote on 9/22/08 3:25 PM: IF(C1-D1<=365,C1-D1,0) Maybe you can do something with this formula that determines either the 366 or the 365 day year. =IF(MOD(YEAR(C1),4)=0,366,365) Good Luck, Jim May |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sandy Mann,
Hey, it worked!. Thanks very much. Now I just have to understand it. -- Howard "Sandy Mann" wrote: Does: =IF(OR(D1-C1<=365,AND(OR(DAY(DATE(YEAR(C1),2,29))=29,(DAY(DA TE(YEAR(D1),2,29)=29))),D1-C1=366)),D1-C1,0) do what you want? There may be more elegant solutions. -- HTH Sandy In Perth, the ancient capital of Scotland and the crowning place of kings Replace @mailinator.com with @tiscali.co.uk "Sean Timmons" wrote in message ... this is a puzzler. Difficulty with the below is does not account for cases where D1 is a leap year and the end date is past February. We can get there using lots of if statements, but isn't there a less obfuscated way than that? Also, technically, we'd have to account for years such as 1900, 2100, et. al. that are not leap years... "Jim May" wrote: in article , Howard at wrote on 9/22/08 3:25 PM: IF(C1-D1<=365,C1-D1,0) Maybe you can do something with this formula that determines either the 366 or the 365 day year. =IF(MOD(YEAR(C1),4)=0,366,365) Good Luck, Jim May |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
The problem resoves itself down to is testing for a period or 365 days or
less with the sole exception of 366 days *provided* that the 366 days includes February 29th. I therefore check for 365 days or less OR 366 days with one of the years having a February 29th. -- HTH Sandy In Perth, the ancient capital of Scotland and the crowning place of kings Replace @mailinator.com with @tiscali.co.uk "Howard" wrote in message ... Sandy Mann, Hey, it worked!. Thanks very much. Now I just have to understand it. -- Howard "Sandy Mann" wrote: Does: =IF(OR(D1-C1<=365,AND(OR(DAY(DATE(YEAR(C1),2,29))=29,(DAY(DA TE(YEAR(D1),2,29)=29))),D1-C1=366)),D1-C1,0) do what you want? There may be more elegant solutions. -- HTH Sandy In Perth, the ancient capital of Scotland and the crowning place of kings Replace @mailinator.com with @tiscali.co.uk "Sean Timmons" wrote in message ... this is a puzzler. Difficulty with the below is does not account for cases where D1 is a leap year and the end date is past February. We can get there using lots of if statements, but isn't there a less obfuscated way than that? Also, technically, we'd have to account for years such as 1900, 2100, et. al. that are not leap years... "Jim May" wrote: in article , Howard at wrote on 9/22/08 3:25 PM: IF(C1-D1<=365,C1-D1,0) Maybe you can do something with this formula that determines either the 366 or the 365 day year. =IF(MOD(YEAR(C1),4)=0,366,365) Good Luck, Jim May |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculating sales commission that changes based on a sales volume | Excel Worksheet Functions | |||
Sales Invoicing linked to Sales ledger(Accounts Receivable) | Excel Discussion (Misc queries) | |||
Add Sales Goals to Sales Report in Pivot Table | Excel Discussion (Misc queries) | |||
sales needed to cover costs that increase as sales do | Excel Worksheet Functions |