+ Reply to Thread
Results 1 to 10 of 10

Calculating number of personnel by status and hire date

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105

    Calculating number of personnel by status and hire date

    I am trying to create a formula that will compare data in two columns on a sheet and return the count of those employees.


    The goal is to return the number of managers hired in 2003:
    =SUMPRODUCT(IF(EmpList!$G$2:$G$15000,"Mgr")*(YEAR((EmpList!$H$2:$H$15000)=2003)))

    Column G holds their positions (Mgr, Emp1, Emp2, etc.), and column H is the hire date in mm/dd/yy format.

    But I am returning #value.

    What would be the correct formula?

    TIA
    Last edited by F6Hawk; 01-23-2023 at 04:04 PM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,911

    Re: Calculating number of personnel by status and hire date

    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105

    Re: Calculating number of personnel by status and hire date

    Here ya go.
    Attached Files Attached Files
    Last edited by F6Hawk; 01-23-2023 at 04:24 PM.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,911

    Re: Calculating number of personnel by status and hire date

    instead of a formula, I would employ Power Query. Here is the Mcode for that

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Hire Date", type date}, {"Birthdate", type date}}),
        #"Inserted Year" = Table.AddColumn(#"Changed Type", "Year", each Date.Year([Hire Date]), Int64.Type),
        #"Grouped Rows" = Table.Group(#"Inserted Year", {"Year", "Stat"}, {{"Count", each Table.RowCount(_), Int64.Type}})
    in
        #"Grouped Rows"
    Power Query is a free AddIn for Excel 2010 and 2013, and is built-in functionality from Excel 2016 onwards (where it is referred to as "Get & Transform Data").

    It is a powerful yet simple way of getting, changing and using data from a broad variety of sources, creating steps which may be easily repeated and refreshed. I strongly recommend learning how to use Power Query - it's among the most powerful functionalities of Excel.

    - Follow this link to learn how to install Power Query in Excel 2010 / 2013.

    - Follow this link for an introduction to Power Query functionality.

    - Follow this link for a video which demonstrates how to use Power Query code provided.

    If you only want to do lookups for particular years, then post back and I will modify the query to that means.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105

    Re: Calculating number of personnel by status and hire date

    Thanks Alan. I am currently using 2016 for Mac (Retired), but have purchased and need to install Office 365; is it included in either of these versions?

    I'm not finding it for Excel for Mac...
    Last edited by F6Hawk; 01-23-2023 at 09:56 PM.

  6. #6
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105

    Re: Calculating number of personnel by status and hire date

    So without this Power Query option... what formula would return my needed data?

    Thanks!

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,911

    Re: Calculating number of personnel by status and hire date

    Power Query is included in O365 and is called Get and Transform Data and found on the Data Tab. It is not on Excel for Mac.

  8. #8
    Forum Expert
    Join Date
    09-25-2015
    Location
    Milan Italy
    MS-Off Ver
    office 365
    Posts
    2,009

    Re: Calculating number of personnel by status and hire date

    Counts


    A2=IF(Counts!A$1<>"",SUMPRODUCT((EmpList!$F$2:$F$1000=Counts!A$1)*(YEAR(EmpList!$G$2:$G$1000)=2003)),"")

    Copy across

  9. #9
    Forum Contributor
    Join Date
    02-20-2007
    Location
    Alaska
    MS-Off Ver
    2003, 2007, 2010
    Posts
    105

    Re: Calculating number of personnel by status and hire date

    Nailed it!! Thanks so much @CARACALLA! So simple, now that I see your solution. Much appreciation to you both.


    Quote Originally Posted by CARACALLA View Post
    CountsA2=IF(Counts!A$1<>"",SUMPRODUCT((EmpList!$F$2:$F$1000=Counts!A$1)*(YEAR(EmpList!$G$2:$G$1000)=2003)),"")

    Copy across

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2506 Win 11
    Posts
    24,911

    Re: Calculating number of personnel by status and hire date

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Help: count number of personnel per hour interval
    By DeltaIV in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-17-2022, 02:18 PM
  2. find out hire rates costs for multiple hire and of hire dates
    By ssk1966 in forum Excel - New Users/Basics
    Replies: 10
    Last Post: 01-14-2021, 07:00 AM
  3. Replies: 1
    Last Post: 11-30-2020, 08:52 PM
  4. Calculating PTO by hire date and Jan-1 reset
    By AirplaneGuy737 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-28-2020, 09:54 PM
  5. Macro to Track Prospect Status and Date of Status Change
    By zainfidel in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-24-2016, 02:16 PM
  6. Replies: 2
    Last Post: 05-30-2012, 10:53 AM
  7. Calculate number of years and months employed using hire date and.
    By TryingTime in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-28-2006, 11:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1