+ Reply to Thread
Results 1 to 18 of 18

Adding rows with Control Number that only repeat 3 times: Formula

  1. #1
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Adding rows with Control Number that only repeat 3 times: Formula

    Hi,

    I'll try to explain this the best I can. What I have here is a time study. Teachers (which are the control numbers) fill out bubble sheets, then I run them through a scanner. After dissecting the data from the scanner and formatting it to my liking i get this below.

    Each teacher/staff member fills out three sheets per quarter. Each letter (bubble) counts as a 0:15 min period of time. Only K thru Q counts as billable time, which I've created a formula to count those letters (column 3). But to be countable each control number has to have three cycles 201,202,203.

    So I need something that can take each control number that has three cycles and add their # of 0:15 together.

    The italic row below only has one cycle for that control number, so that needs to be deleted or ignored.

    Ultimately I would like the results on a separate sheet.

    This is only a part of the file, there are over 1000 different control numbers.

    Please Login or Register  to view this content.
    I hope I explained it well enough.

    Thanks,
    Gman2005
    Attached Files Attached Files
    Last edited by Gman2005; 04-05-2009 at 07:31 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Need Formula

    Please read the forum rules, and then amend your thread title.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Thanks, much better.

    Post a workbook with a meaningful sample of data, and a few manually-worked answers?

  4. #4
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Quote Originally Posted by shg View Post
    Thanks, much better.

    Post a workbook with a meaningful sample of data, and a few manually-worked answers?
    Posted a workbook with sample data and results.

    Thanks,
    Gman2005

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    In C22 and copy down this array formula:

    =IF( AND( ISNUMBER( MATCH({201,202,203} & B22, $A$2:$A$17 & $B$2:$B$17, 0) ) ), SUMPRODUCT( OR($A$2:$A$17={201,202,203}) * ($B$2:$B$17=B22) * $C$2:$C$17), 0)

    You MUST confirm this formula with Ctrl+Shift+Enter, not just Enter.

    The formula in C2 and down can be simplified to this regular formula:

    =SUM(LEN(D2) - LEN(SUBSTITUTE(D2, {"K","L","M","N","O","P","Q"}, "") ) )

  6. #6
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Quote Originally Posted by shg View Post
    In C22 and copy down this array formula:

    =IF( AND( ISNUMBER( MATCH({201,202,203} & B22, $A$2:$A$17 & $B$2:$B$17, 0) ) ), SUMPRODUCT( OR($A$2:$A$17={201,202,203}) * ($B$2:$B$17=B22) * $C$2:$C$17), 0)

    You MUST confirm this formula with Ctrl+Shift+Enter, not just Enter.

    The formula in C2 and down can be simplified to this regular formula:

    =SUM(LEN(D2) - LEN(SUBSTITUTE(D2, {"K","L","M","N","O","P","Q"}, "") ) )
    Thanks for the fast reply, but I'm not sure if i'm doing this right. Why do I put it in C22?

    Attached is the full file for your looking. Maybe that will help better.

    Thanks,
    Gman2005
    Attached Files Attached Files

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    C22 in the workbook you posted previously.

  8. #8
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Quote Originally Posted by shg View Post
    C22 in the workbook you posted previously.
    I did. But it doesn't do anything. All I get is zero. And I did Control Shift Enter.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    See attached.
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    OK, now I see.

    I need to have the control numbers listed again.

    Not solved yet. I'll be back for an additional formula.

    Thanks for your help so far.


    -Gman2005

  11. #11
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Problem:

    The formula does not remove the control numbers that only have 1 or 2 cycles. I can only have control numbers in my results with all three cycles (201, 202, 203).

  12. #12
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    The formula does not remove the control numbers that only have 1 or 2 cycles
    I don't think so, Gman.

    What result do you see in C22?

    What result do you see if you delete row 2, 3, or 4?

  13. #13
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    ok,

    you're right. it does. it puts their values to zero.

    Now, how can I delete control numbers (in my results) that have values of zero?

    Thanks so much for helping me.

    -Gman2005

  14. #14
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Sorry, I don't grok the question.

  15. #15
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Shg,

    I need my formula edited.

    See attached workbook.


    Thanks much,

    Gman2005
    Attached Files Attached Files

  16. #16
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    Formulas can't delete anything. Why not just leave them? For one thing, it makes clear that they have not been omitted from the calculation.

    You can do a two-way sort do they end up at the bottom of the list (as they coincidently happen to now).

    I would change the formula in Q2 to =SUMPRODUCT( ($B$2:$B$11=$O2) * ($P2>0) * D$2:D$11), then copy across and down.

  17. #17
    Registered User
    Join Date
    03-20-2009
    Location
    U.S.A.
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    i wasn't asking for a formula to delete this time, but
    Please Login or Register  to view this content.
    will work for me to show those extra columns in my results

  18. #18
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Adding rows with Control Number that only repeat 3 times: Formula

    So it's sorted? And if so, would you please mark the thread as Solved?

    Click the Edit button on your first post in the thread

    Click Go Advanced, select [SOLVED] from the Prefix dropdown, then click Save Changes

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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