+ Reply to Thread
Results 1 to 5 of 5

Counting data per person in a table

  1. #1
    Registered User
    Join Date
    02-20-2018
    Location
    Home 2016
    MS-Off Ver
    2016
    Posts
    10

    Post Counting data per person in a table

    Hello everyone,

    I have to create a table which will find exact name and surname from the column with names and surnames and then count how many times specified text occured within row where this name and surname is. I also have to do this per month. The range of months is of course dynamic (30,31,28/29days).

    In the first data table you can see I have names and surnames in column B, then I have a table with schedule with shifts marked as D,N,ML,DOTs with numbers. I only want to count how many DOT8/DOT9/DOT12 Name and surname has and then multiply accordingly to number next to, so "*8","*9","*12" per month and then SUM it to get totals. Important thing is that in the main table, so Data table the positions of names and surnames will be changing later on, they might be in lower or higher row.

    The end table can't be on the same sheet as data table.
    Attached Files Attached Files
    Last edited by Miniuka; 06-19-2018 at 07:21 AM.

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,498

    Re: Counting data per person in a table

    I'm a bit confused by your description and sheet. Perhaps a sample of the output would help? Here is what confuses me,
    I have a table with schedule with shifts marked as D,N,ML,DOTs with numbers AND then multiply accordingly to number next to, so "*8","*9","*12" per month and then SUM it to get totals.
    I can get you a total by adjusting your "data table" and "the table I need" tabs with some tweaks, for example replace the values in row 2 of the data table with actual dates such as 4/1/2018 (formatted any way you want) then dragged right. Then also change the dates in row 1 of "the table I need" from April to 4/1/2018 (formatted as mmm-yy so it looks like Apr-18) then this sumproduct will return the counts of DOT8 (for example) for Paul John...
    =SUMPRODUCT(('Data table'!$B$4:$B$8=$A3)*('Data table'!$D$4:$CP$8=B$2)*('Data table'!$D$2:$CP$2>=B$1)*('Data table'!$D$2:$CP$2<=EOMONTH(B$1,0)))
    But what I don't get is how you want the Ds handled for Paul. For example, for April Paul has 5 Ds, 5 Ns, 1 H and no DOTs. So what should his results be?
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: Counting data per person in a table

    I would also suggest using real dates, that way you can use excel's built-in date functions.

    I would also suggest swinging your table around, so you have dates going down, and names across.

    I tried Sambo's suggested formula, and it worked for me, too
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    Registered User
    Join Date
    02-20-2018
    Location
    Home 2016
    MS-Off Ver
    2016
    Posts
    10

    Re: Counting data per person in a table

    Thank you for answers.

    I can't change format of dates. I can't replace "values" in the table, the only "value" I can change are values of DOT8 to 8, DOT10 to 10, DOT12 to 12, NOT12 to 12.

    The data I have to calculate is: how many DOT8,DOT10,DOT12 and NOT12 person has per month in Example workbook. Then the result of each DOT and NOT I have to multiply by 8, 10, 12 depending on the number next to DOT or NOT (Original table with 12 months has DOTs and NOTs with numbers: 8,9,10,11,12).
    The data in original table are separated as quarter of the year per sheet. The positions of names and surnames are different in every sheet + in one quarter there is +1 person more.
    All the calculations must be done in 1 table in separate sheet.

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,498

    Re: Counting data per person in a table

    The problem with what you posted is that you DON'T have dates. You have text in row 1 and numbers in row 2 of the data table. For example, the #1 in cell D2 of the data table isn't recognized by excel as a date. The word April cell S1 is just text, excel doesn't recognize it as a date. To leave it as it is and try to write a formula for excel to do a combination of S1 and D2 then S1 and E2 and S1 and F2 (etc.) so excel would convert them to dates would be very convoluted. Maybe it can be done with VBA.
    Good luck.

+ 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] Run calculations in template for 1 person, copy-paste results, repeat for next person
    By Geoff. in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-25-2014, 06:02 PM
  2. VBA to convert person-to-event into person-person
    By LuckyStrike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-07-2014, 02:34 PM
  3. Extracting data from file in directory and extracting filename
    By brad999 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-20-2014, 11:21 AM
  4. A way to send file to certain person, depending on person saving?
    By shiftyspina in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2014, 12:13 PM
  5. Transpose/Pivot multiple rows per person into 1 row per person with fixed columns
    By MaestroEnrique in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2013, 06:35 AM
  6. same person, different dates...need the latest date from every person
    By Tanisman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-26-2011, 07:16 AM
  7. Replies: 3
    Last Post: 02-27-2007, 05:27 AM

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