Office & Productivity Software forum

General discussion

Excel Time of Service Calculation

by Andrea B. / November 20, 2004 3:56 AM PST

I need to know how many years/months someone has been with the company - currently, I'm using:
=((YEAR(H2)-YEAR(B2))*12+MONTH(H2)-MONTH(B2))/12

wich works until hire and current months are the same but hire date is before current.

I mean, someone who hired in 11-10-03 by today (11-20-04) has been with the company 11 months (and change) - but with my formula this appears 1 year - correctly rounding up - but in this case, this is bad because it will make it appear as the employee's 1 year anniversary had already passed.

How can I keep it from rounding up?

Discussion is locked
You are posting a reply to: Excel Time of Service Calculation
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Excel Time of Service Calculation
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
Re: Excel Time of Service Calculation
by Kees Bakker / November 20, 2004 6:53 AM PST

Use an if-function comparing the days:

=if (day of current-date>=day of hire-date, your formula, your formula minus something)

I think it's more difficult in fact to get it expressed as 1 yr and 2 months (your formula seems to give 1.16666666) but if you don't want to round up, this simple if-function, making a difference between "from 10 to 20 round-up and from 20 to 10 don't" should work. That's the difference you want to make, if I understand your problem correctly.
And, of course, the principle is useful for 1 yr-2 mnths notation also.

Hope this helps.


Kees

Collapse -
Re: Excel Time of Service Calculation
by swisse / November 20, 2004 6:28 PM PST

Excel was right. 11-20-04 is 1 year and 10 days older than 11-10-03. Maybe what you meant was that he was hired 11-20-03 and your today is 11-10-04.

Collapse -
Re: Excel Time of Service Calculation
by Andrea B. / November 20, 2004 9:11 PM PST

You are right - I had it backwards - but I figured it out using Kees' hint:
=IF(AND(MONTH(B2)=MONTH(H2),DAY(B2)>DAY(H2)),((YEAR(H2)-YEAR(B2))*12+MONTH(H2)-MONTH(B2)-1)/12,((YEAR(H2)-YEAR(B2))*12+MONTH(H2)-MONTH(B2))/12)

Collapse -
Re: Excel Time of Service Calculation
by Andrea B. / November 20, 2004 9:16 PM PST

Wow - looking at this in FireFox, my formula does not wrap but it runs way out on the right out of the box, over the ads, into the yellow right border...........

So for fun I ran the HTML validator - that did not go well!

Collapse -
Good job and glad I could help.
by Kees Bakker / November 21, 2004 2:52 AM PST

And I posted a link to your remark on the Feedback Forum. Maybe Lee can find some resources to fix the forum software.

Kees

Popular Forums
icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

CNET FORUMS TOP DISCUSSION

Help, my PC with Windows 10 won't shut down properly

Since upgrading to Windows 10 my computer won't shut down properly. I use the menu button shutdown and the screen goes blank, but the system does not fully shut down. The only way to get it to shut down is to hold the physical power button down till it shuts down. Any suggestions?