+ Reply to Thread
Results 1 to 8 of 8

Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

  1. #1
    Registered User
    Join Date
    07-14-2010
    Location
    Hot Springs, AR
    MS-Off Ver
    2010
    Posts
    38

    Wink Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    I have several hundred rows of data. ColB contains search criteria, i.e. "Apple" for this example.

    I want to search ColB for "Apple", then count non-empty cells in ColC until the next "Total" (there are many) is found in ColB. Below example would return 5. VBA preferable.


    ---------ColA-----ColB-----ColC
    Row11------------Apple
    Row12---------------------abc
    Row13---------------------abc
    Row14
    Row15---------------------def
    Row16---------------------def
    Row17---------------------def

    ------------------Total

    Thanks,
    roothog

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    Try this:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-14-2010
    Location
    Hot Springs, AR
    MS-Off Ver
    2010
    Posts
    38

    Re: Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    Works perfectly! Thanks, Millz!!!

    Now for a follow-up question...how can I put that value into a cell on the worksheet? Say, cell D1?

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-14-2010
    Location
    Hot Springs, AR
    MS-Off Ver
    2010
    Posts
    38

    Re: Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    Works perfectly....again! Thanks for you time and expertise!

  6. #6
    Registered User
    Join Date
    07-14-2010
    Location
    Hot Springs, AR
    MS-Off Ver
    2010
    Posts
    38

    Re: Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    In using this I have found an anomaly I can't solve. What can I add in the event my search does not yield a result? In the above example, the macro stops at the "findrow" line if it doesn't find "Apple".

    Thanks,
    roothog

  7. #7
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    Here is an example, you can also apply it to the finding of "Total" if needed.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-14-2010
    Location
    Hot Springs, AR
    MS-Off Ver
    2010
    Posts
    38

    Re: Find "Apple" in ColB, then count ColC until the next "Total" is found in ColB

    Thanks again, millz, for solving a second time. Works like a charm.
    roothog

+ 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. find first row were colA, colB, colC and colD equal specific values
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-26-2013, 10:33 AM
  2. Replies: 3
    Last Post: 04-14-2013, 11:53 PM
  3. [SOLVED] How to Count number of "Error" and "OK" after the word "Instrument" found in table row
    By eltonlaw in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-17-2012, 06:26 AM
  4. Replies: 5
    Last Post: 06-26-2006, 09:23 PM
  5. Replies: 7
    Last Post: 05-13-2006, 05:02 PM

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