Two Topics: 1 Table related question, the other formula assistance requested.

HalpNeeded

New Member
Joined
May 4, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hello,

In plain English I am trying to do the following:

1) The row 1 date cells are Category "Custom" mmm-yy
2) The Hire/Attrition Date cells are Category m/d/yyyy

I am trying to count the number of months a person has been with the company (this is historical data) based on their hire date, by month. My poor formula does this after digging all around trying to figure out how the heck this works. If there is a better/cleaner way I am all ears.

I am also trying to expand the formula to when an attrition date is entered, the formula will pick that up and provide an ending value (red cell) with the cells to the right being blank or "N/A" etc. indicating the person is no longer with the company.

1652822208943.png


Does anyone have a suggestion how this can be accomplished?



My question about the Table is a bit more confusing...if I convert these values to a table without changing any formulas, or doing anything else, the formula seems to break because, i assume, the table starts doing strange Category stuff for headers that I simply cannot change (I change the Category to mmm-yy, or Date, or Number, General, etc. but nothing changes and the values are still showing 19, 20, etc.) Please see the screenshot for what I am talking about. Only the 2021 months are wrong, and I have no idea why.

1652822951879.png



I would appreciate any insight or help from you experts.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Does this give you what you want?

help needed.xlsx
ABCDEFGHIJKLMNOPQR
1#nameHire DateAttrition DateOct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22
21John3/1/202178910111213141516171819
32Mary4/23/20183/27/2022     47       
4
5
6#nameHire DateAttrition DateOct-21Nov-21Dec-21Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22
71John3/1/202178910111213141516171819
82Mary4/23/20183/27/2022     47       
9
Sheet1
Cell Formulas
RangeFormula
E2:Q3,E7:Q8E2=IF(AND($C2<>"",$D2=""),DATEDIF($C$2,E$1,"M"),IF(AND($C2<>"",$D2<>"",(MONTH($D2)&YEAR($D2)=MONTH(E$1)&YEAR(E$1))),DATEDIF($C2,$D2,"M"),""))
 
Upvote 0
Hello Kevin9999,

Sorry, I was out of town I did not see your reply. It is super close for sure. I worked through it with your help of MONTH($D2)&YEAR($D2)=MONTH(E$1)&YEAR(E$1

What I came up with (and added a few more Ifs, to ensure blanks were dealt with, etc.) was this:

=IF($D2="","",IF($D2>F$1,"",IF(AND($E2<>"",$E2>F$1),DATEDIF($D2,F$1,"M"),IF(AND($E2<>"", MONTH($E2)&YEAR($E2)=MONTH(F$1)&YEAR(F$1))),DATEDIF($D2,F$1,"M"),IF($E2="",DATEDIF($D2,F$1,"M"),"")))))

Thank you for your assistance, it pushed me to the right solution!
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top