+ Reply to Thread
Results 1 to 6 of 6

Quick help requested!! "Grouping" Formula or VBA fix

  1. #1
    Registered User
    Join Date
    11-16-2008
    Location
    USA
    Posts
    27

    Quick help requested!! "Grouping" Formula or VBA fix

    Hi Everyone, haven't been here in a while!

    I'm desperately (and quickly!) needing a way to do the following. A formula is preferred, but a VBA method might work ok, too.

    (Simplifying a bit here)..

    In a column, let's say colC, I might have several "start" and "stop" points - these are placed to correspond with certain data in colD.

    I'm looking for something that can identify all sets data BETWEEN this "Start" and "Stop" points in colC. So, looking for something which labels all that data as a particular word; "true", "data", "information" or something like that.

    This formula will be in colB. Needs to begin identifying "grouping" when it catches a "Start" point in colC, and end grouping when it hits a "Stop" point in colC. It then leaves cells blank until it hits the NEXT "Start" point, then groups until the next "Stop" point, etc.

    I've attached a bit of an example spreadsheet. Hopefully this makes sense! Thanks everyone!!
    Attached Files Attached Files
    Last edited by mocp2008; 06-28-2009 at 03:50 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: Quick help requested!!

    Does the attached help? The yellow column contains the relevant formula.

    PS- You may need to refer to the forum rules re descriptive titles to your posts. I suspect a moderator may view your 'Quick help requested' title as stretching the envelope a bit too much.....
    Attached Files Attached Files
    Excel 365 user. To unblock a downloaded macro-enabled workbook, go to your "Downloads" folder > right click on the workbook name > click 'Properties' > check the 'Unblock' checkbox. You can now open the workbook.

  3. #3
    Registered User
    Join Date
    11-16-2008
    Location
    USA
    Posts
    27

    Re: Quick help requested!! "Grouping" Formula

    Thanks. That worked, except that it did not include the "Stop" point in the group. It's ending one line before it.

    But, it looks like a formula fix for this isn't going to work... It took an hr to run what looks to be about 20% (it's a VERY long file.) Any suggestions for a VBA solution?

    (I fixed the header to be a bit more descriptive, too. Thanks)

  4. #4
    Valued Forum Contributor
    Join Date
    08-31-2007
    Location
    SW Ireland
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2311 Build 16.0.17029.20068) 32-bit
    Posts
    540

    Re: Quick help requested!! "Grouping" Formula or VBA fix

    Hi,

    I'm not a VBA person so am afraid I can't help you there.

    Could you explain how my formula doesn't include the 'Stop' point/ is ending one line before it. As I see it, the word 'information' IS being entered in all cells between 'Start' and 'Stop' and includes the cells immediately adjacent to 'Start' and 'Stop'. If it's supposed to enter the word 'Information' 1 line after the word 'Stop' the proposed formula could be changed.

    However, as you point out, the VBA approach may be a better approach so I won't propose a change yet.

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Quick help requested!! "Grouping" Formula or VBA fix

    deadlyduck's formula seems to work and I thought it was rather clever. Here is a VBA approach:
    Please Login or Register  to view this content.

  6. #6
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Quick help requested!! "Grouping" Formula or VBA fix

    you could try in E2 (but you must have a blank above e2 to start)
    =IF(OR(C2="start",ISTEXT(E1)),(IF(AND(C2="",E1=""),"",IF(C1="stop","",B2))),"")
    Last edited by martindwilson; 06-28-2009 at 06:06 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

+ 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