+ Reply to Thread
Results 1 to 5 of 5

Excel (Formula/VBA) Help: Counting data on 2 separate sheets

  1. #1
    Registered User
    Join Date
    10-18-2022
    Location
    London, England
    MS-Off Ver
    365
    Posts
    19

    Excel (Formula/VBA) Help: Counting data on 2 separate sheets

    Hello,

    My absence tracker records each occasion of absence using a new row. So, if an employee was sick on 04/05/2022 and sick again on 09/06/2022, the employee would have 2 rows containing absence, as it would be 2 separate occasions.

    I have three sheets: "current 6 months" (absence is manually added here daily), "previous 6 months" and "last 12-24 months". Each new day, a piece of VBA code automatically moves the row to the relevant sheet upon workbook open, based on absence start date and deletes if older than 24 months.

    I need to be able to see occasions of absence over the last 12 months, so basically how many occasions over the 2 sheets: "Current 6 months" and "previous 6 months".

    I would need a separate sheet for this called something like "occasions last 12 months".

    Each row (occasion) begins with the employee ID in column A, so a formula like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    could pull unique employee IDs from the 2 sheets into column A, then something like:
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    could count how many times each employee ID appears in the two sheets, which would tell me how many occasions. Maybe?? Not sure...

    If I could just get one of each employee ID from the two sheets into column A and then count how many times each employee ID appears over the two sheets, that'd be it... but I can't do it and I've spent hours... days on it.

    My novice ability with Excel unfortunately restricts me.

    Hoping someone can kindly help.

    Kind Regards
    Last edited by Chris_M_1987; 10-29-2022 at 11:55 AM.

  2. #2
    Registered User
    Join Date
    10-18-2022
    Location
    London, England
    MS-Off Ver
    365
    Posts
    19

    Re: Excel (Formula/VBA) Help: Counting data on 2 separate sheets

    Here is a copy of my workbook, with all the information anonymised with the names of UK comedians as examples
    Attached Files Attached Files

  3. #3
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,531

    Re: Excel (Formula/VBA) Help: Counting data on 2 separate sheets

    If the protection is removed from the master data sheet, then a column could be added that would be populated using a COUNTIFS formula (such as the one below) to count the occurrences of an employee ID on the previous and current 6 months sheets.
    An Index/Aggregate formula could then be written to populate column A of the occasions last 12 month sheet.
    Example:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Column B could be populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    To see the above applied to the file please remove the protection from the master data sheet.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  4. #4
    Registered User
    Join Date
    10-18-2022
    Location
    London, England
    MS-Off Ver
    365
    Posts
    19

    Re: Excel (Formula/VBA) Help: Counting data on 2 separate sheets

    Hello

    Thanks very much for this, it works

    Kind Regards
    Chris
    Slowly learning Visual Basic for Applications

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,531

    Re: Excel (Formula/VBA) Help: Counting data on 2 separate sheets

    You're Welcome. Thank You for the feedback and for marking the thread as 'Solved'. I hope that you have a blessed day.

+ 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. Replies: 4
    Last Post: 06-04-2019, 05:20 PM
  2. [SOLVED] Excel formula to Unhide sheets from an excel file
    By PRADEEPB270 in forum Excel General
    Replies: 2
    Last Post: 09-25-2017, 01:00 AM
  3. Formula for two sheets in excel 2013
    By imadbaalbaki in forum Excel General
    Replies: 1
    Last Post: 03-14-2017, 07:10 AM
  4. If Then Copy Excel Formula 2 sheets
    By mick37 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-16-2015, 10:09 PM
  5. Help with Excel Dates transfer between different sheets formula
    By bossman71 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-20-2014, 01:15 PM
  6. Excel formula's on seperate sheets
    By Thomsk in forum Excel General
    Replies: 3
    Last Post: 04-17-2012, 06:23 PM
  7. Excel 2007 : Excel Formula (comparing 2 sheets)
    By sandyl in forum Excel General
    Replies: 3
    Last Post: 12-01-2010, 03:39 PM

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