+ Reply to Thread
Results 1 to 9 of 9

Year to date of workforce

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    Moline, IL
    MS-Off Ver
    Excel 2007
    Posts
    9

    Year to date of workforce

    I have a problem coming up with a function to get the most recent number in a row. I have to get the most recent number of employees employed for a year to date value. Is there a formula that would help me get this. I have tried non-null formulas but I don't think I know how to implement it. Attached is a simple file showing it and the highlighted cell that the formula would need to be in. So when making a monthly report for August I need the August workforce there and next month when I make a monthly report for September I need the entry in September filled in the YTD column. Just trying to make this as automated as possible. Please help.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Year to date of workforce

    try

    =INDEX($A$2:$L$2,MATCH(99^99,$A$2:$L$2,1))
    The Importance of INDEX - A GUIDE TO INDEX'S OTHER USES
    <--- If a post helps hit the star

  3. #3
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Year to date of workforce

    Hi Bigern87,

    Welcome to the forum.

    So when making a monthly report for August I need the August workforce there and next month when I make a monthly report for September I need the entry in September filled in the YTD column
    For above, try beloow formula:-
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    See attached:- YTD Workforce count.xlsx

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), [email protected]

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Year to date of workforce

    sorry yes my formula only shows the last entry.

    the above will work though so guess you have a neat solution

    although if you are makeing a report for may inseptember you will need to alter that (using a secondary cell)

    to =INDEX($A$2:$L$2,,MATCH($N$2,$A$1:$L$1,0))

    (i also added data validdation to get a list in cell N2 for ease)


    YTD Workforce count (1).xlsx
    Last edited by twiggywales; 08-31-2012 at 12:23 PM.

  5. #5
    Registered User
    Join Date
    08-31-2012
    Location
    Moline, IL
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Year to date of workforce

    Thank you for both of those, they work great. Can I get an explanation as to why those both work? I just want to know for future reference what kind of syntax to be using. I also found another formula online that works but again do not know the meaning of the functions:

    =INDEX(A2:L2, COUNT(A2:L2))

    Let me know if anyone can help with this.

  6. #6
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Year to date of workforce

    i updated my post above wich you may be interested in.

    ill explain how they all work

    first

    Please Login or Register  to view this content.
    match looks at an range of cells and returns the matching value, however in this case (99^99) will never be matched so using the ,1 highlighted you return the value of the last row/column in the field (the last one to returns no error), index then uses this to return the corresponding value in that range.

    second

    Please Login or Register  to view this content.
    here the highlighted text causes excell to look at todays date and return the month we are in, it then uses this in the same way as the match and index above works.


    lastly

    Please Login or Register  to view this content.
    works exactly as you'd expect, it matches the row/column with the value in N2 (a list that i generated for ease) and indexes as already mentioned.

    hope this helps. remember once a thread is solved then mark it as solve (thread tools at the top of the page) and star tap thouse that help.

    ---------- Post added at 05:33 PM ---------- Previous post was at 05:29 PM ----------

    also your one

    Please Login or Register  to view this content.
    again similar thing COUNT(A2:L2) counts how many cells have numbers in then uses that for the index.

    I feel this is a bit wrong though as if a cell was blank this would not return the correct column. (test this by leaving may blank and your aughust report will show the value for july)

  7. #7
    Registered User
    Join Date
    08-31-2012
    Location
    Moline, IL
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Year to date of workforce

    Yeah looks like if I leave another column blank, the number is not the most recent. Thank you for all your help!

  8. #8
    Registered User
    Join Date
    08-31-2012
    Location
    Moline, IL
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Year to date of workforce

    Ok now I understand everything except for "MMMM" in the MATCH function. What is the reason for this?

  9. #9
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Year to date of workforce

    Hi Bigern87,

    MMMM in match is matching the month after expanding it to complete month name.. for example Text(Date(2012,01,01),"MMMM") will output the month as "January" and this logic is further used to match the month in your headings.. Hope this helps. thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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