Here's the situation: I've created a spreadsheet in Excel 2010 (Win 7) where
I import daily transactions from our POS software. These transactions have
dates associated with them and I've calculated the time-delta between "First
Import" vs. "Last Import".
Here's what I've got so far...
First Import: 08/11/2009: Tue → Cell Name: LdgrImp_First
Last Import: 06/22/2011: Wed → Cell Name: LdgrImp_Last
Days in Range: 680 days → Cell Name: LdgrImp_RangeTotal
I'd like to break the above "Days in Range" of my calculated 680 days into
the following:
Years: _____ yrs → Cell Name: LdgrImp_Year
Months: _____ mos → Cell Name: LdgrImp_Month
Days: _____ days → Cell Name: LdgrImp_Days
My attempts at the code:
Years: "=ROUNDDOWN((LdgrImp_RangeTotal/365.25),0)" = 1
Months: "=ROUNDDOWN(((LdgrImp_RangeTotal-(LdgrImp_Year*365.25))/30.4375),0)" = 10
Days: "=ROUNDUP((LdgrImp_RangeTotal-(LdgrImp_Year*365.25)-(LdgrImp_Month*30.4375)),0)" = 11
Additional Notes:
1. To calc QTY years I've divided by 365.25 for Leap Year adjustment
→ 365 days * 3 years | plus a Leap Year | divided by 4 years
→ (((365*3)+366)/4) = 365.25 days/year
2. To calc QTY months I've divided by 30.4375 for Leap Year adjustment
→ Calculated average QTY days/yr | divided by 12 months
→ (365.25/12) = 30.4375 days/month
2. To calc QTY days I've subtracted the calculated "Years" and "Months"
from the "Days in Range"
and rounded UP to a whole number
→ (680-(1*365.25)-(10*30.4375)) = 11 days left over
My dilemma is that even though I'm conscious of taking into account of Leap
Year, my month QTY will still be represented by an "Average Days/Month"
instead of actual. This miscalculation will daisy-chain an error into my
calculated "Day" QTY.
I'm betting there's a *MUCH* easier way to do this???
I import daily transactions from our POS software. These transactions have
dates associated with them and I've calculated the time-delta between "First
Import" vs. "Last Import".
Here's what I've got so far...
First Import: 08/11/2009: Tue → Cell Name: LdgrImp_First
Last Import: 06/22/2011: Wed → Cell Name: LdgrImp_Last
Days in Range: 680 days → Cell Name: LdgrImp_RangeTotal
I'd like to break the above "Days in Range" of my calculated 680 days into
the following:
Years: _____ yrs → Cell Name: LdgrImp_Year
Months: _____ mos → Cell Name: LdgrImp_Month
Days: _____ days → Cell Name: LdgrImp_Days
My attempts at the code:
Years: "=ROUNDDOWN((LdgrImp_RangeTotal/365.25),0)" = 1
Months: "=ROUNDDOWN(((LdgrImp_RangeTotal-(LdgrImp_Year*365.25))/30.4375),0)" = 10
Days: "=ROUNDUP((LdgrImp_RangeTotal-(LdgrImp_Year*365.25)-(LdgrImp_Month*30.4375)),0)" = 11
Additional Notes:
1. To calc QTY years I've divided by 365.25 for Leap Year adjustment
→ 365 days * 3 years | plus a Leap Year | divided by 4 years
→ (((365*3)+366)/4) = 365.25 days/year
2. To calc QTY months I've divided by 30.4375 for Leap Year adjustment
→ Calculated average QTY days/yr | divided by 12 months
→ (365.25/12) = 30.4375 days/month
2. To calc QTY days I've subtracted the calculated "Years" and "Months"
from the "Days in Range"
and rounded UP to a whole number
→ (680-(1*365.25)-(10*30.4375)) = 11 days left over
My dilemma is that even though I'm conscious of taking into account of Leap
Year, my month QTY will still be represented by an "Average Days/Month"
instead of actual. This miscalculation will daisy-chain an error into my
calculated "Day" QTY.
I'm betting there's a *MUCH* easier way to do this???