+ Reply to Thread
Results 1 to 5 of 5

Need code to average certain cells

  1. #1
    Registered User
    Join Date
    08-02-2012
    Location
    phoenix
    MS-Off Ver
    Excel 2003
    Posts
    2

    Need code to average certain cells

    Hello, I'm pretty much a VBA novice. I can usually come up with some resolution for my questions in this forum but stuck on this one.
    I average response times for emergency vehicles. I've been doing this section by using average formulas manually. Id like to program a code that will select vehicle response times. The problem is this is a month to month moving target.
    I want to average the response times for Engine 99, the response times are in column H. This month it could be in H10 - H23, next month H33 - H55.
    So I need the code that will mark the beginning match then the last match for Engine99 then average those H columns. I can then use that code for each engine.



    Thanks
    Attached Files Attached Files
    Last edited by Alinbuckeye; 04-20-2015 at 12:54 AM. Reason: bad spacing

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,794

    Re: Need code to average certain cells

    Perhaps something like this?

    Please Login or Register  to view this content.
    Not sure about the "NumberFormat" setting, works ok in the Scandinavian environment but you may have to change it to suit your needs.

    Alf
    Last edited by Alf; 04-20-2015 at 02:27 AM. Reason: modified code

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need code to average certain cells

    Maybe:

    Please Login or Register  to view this content.
    Places results in Columns J and K.
    Last edited by JOHN H. DAVIS; 04-20-2015 at 10:16 AM.

  4. #4
    Registered User
    Join Date
    08-02-2012
    Location
    phoenix
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Need code to average certain cells

    Thanks John. That got me my results. Your a vba guru. Al

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Need code to average certain cells

    You're welcome. Glad to help out and thanks for the feedback. Please comply with Forum Rules and mark this thread as SOLVED. See guidelines at the link.

    http://www.excelforum.com/forum-rule...rum-rules.html

+ 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] need formula to average cells but if one cell has N/A then dont average and input N/A
    By CityInspector in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-08-2013, 04:16 PM
  2. Replies: 14
    Last Post: 06-14-2013, 09:00 PM
  3. Replies: 10
    Last Post: 04-25-2013, 06:12 PM
  4. Looking for a code for an average formula that ignores hidden cells.
    By mbrackey in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 12-09-2012, 03:34 AM
  5. The rank of average ranks excluding empty cells but including their average.
    By Terminal45 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-21-2012, 03:44 AM

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