Author Topic: Excel Calculation Question  (Read 1644 times)

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Excel Calculation Question
« on: May 13, 2011, 08:12:15 PM »
Using OpenOffice Calc..

Never really used it for anything more than the basic making a chart kind of thing. I want to use it for something a little deeper now. I need to create a field called Birthday as mm/dd/yyyy. Everytime i open this spreadhseet, it should use that date to display how old in years, months, and days. It's for my dog, and I'm using it to track his shots and different things.

Later i would like to expand it so that it can tell me based on information i provide, when his next shots or booster are due. For example i would program it to know the schedule, and then enter the date of his shots he has had, and it will display when the next is due, and what it is.

But i need to start with basics. I tried researching this some, but the information is overwhelimg and confusing. How in the hell do you guys do this stuff?
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?

Mike

  • Jackass In Charge
  • Posts: 11257
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: Excel Calculation Question
« Reply #1 on: May 13, 2011, 09:38:19 PM »
This might break if the dog was born on the 31st or 29-30 and you are on a March date.  The days part was tricking but the year and month was trivial:
Cells:
B1: Birth date value
B2: =today()
B3: =YEARS(B1;B2;0)
B4: =MOD(MONTHS(B1;B2;0);12)
B5: =DAYSINMONTH(DATE(YEAR(TODAY());MONTH(B2)-1;DAY(TODAY())))-DAY(B1)+DAY(B2)

B3 through B5 is the age in year, month, and days.

The years part should be obvious.
The months I just got the total number of months and mod 12 (since there are 12 months in a year).
The days is the tricky part and where I think it could break.  I first construct a date in last month and then get the number of days in that month.  I then subtract the day part of the birth date and add the day part of the current date.  Basically take the number of days and subtract out how far into the month it was born gives you how many days left in that month and then you add in how far you are in this month.

Steve

  • This 49%er supports Romney
  • Just a Jackass
  • *
  • Posts: 16120
  • Karma: +31/-410
  • Mr. Mom
Re: Excel Calculation Question
« Reply #2 on: May 13, 2011, 10:16:55 PM »
SWEET, this helps a lot because now i can see how it actually works and goes in. He was born on Feb 11
hey ethic if you and i were both courting lily allen..... oh wait, which one of us has a relationship that lasted more than the bus ride home?