+ Reply to Thread
Results 1 to 2 of 2

VBA For Selecting Groups of 25 cells in a column and finding max value of subset

  1. #1
    Registered User
    Join Date
    03-24-2015
    Location
    Illinois
    MS-Off Ver
    MS Office 2010
    Posts
    21

    VBA For Selecting Groups of 25 cells in a column and finding max value of subset

    Hello,
    I have a spreadsheet that collects a value every hour of every day of a month. Then from hours 0000 (midnight) to 0000 (midnight) the next day, I need to grab the max value from those values and input onto another sheet in the workbook. How would I accomplish this?

    I apologize but I tried to attach a spreadsheet example, but could not but I'll best describe my example data. My data is in columns A and B and I want the max values from each day from column B input on another sheet starting from cell A1 all the way to the end of the month. Column A has the date in m/d/yy h:mm format and Column B just has the numerical value for that hour starting from 00:00 all the way to 00:00 of the next day. This data does this for every single day of the month and since there are between 28-31 days in a month, with 25 data points for each hour in one day, it turns out to be almost 1000 rows of data that I know can be handled faster than finding max value of each day manually.

    I don't have the VBA knowledge but in words, what the VBA code should do is:

    1. Select Cell B1 to B25 of Active Sheet
    2. Find Max Value of Cell B1 to B25
    3. Input that Max Value on Sheet 2 in Cell A1
    4. Start at cell B26 to B51
    5. Repeat steps 2 and 3 but put that value in Cell A2
    6. Start at cell B52 to B78
    7. Repeat steps 2 and 3 but put value in cell A3....so on and so forth with each grouping of 25 cells in column B
    8. Repeat until hits blank cell

    What would also be cool is a button that a user could press to execute this VBA code provided the data is in columns A and B as shown on sheet 1 as well.

    Appreciate any assistance with this.

    Thanks,

    Swish

  2. #2
    Registered User
    Join Date
    03-24-2015
    Location
    Illinois
    MS-Off Ver
    MS Office 2010
    Posts
    21

    Re: VBA For Selecting Groups of 25 cells in a column and finding max value of subset

    Also, by the way, the easy answer is a Pivot Table, which I have figured out BUT the problem is the grouping is off by one entry b/c I need the 1st hour of the next day in the max value calculation as well (i.e. the max has to be calculated from midnight of the current day to midnight of the next day).

+ 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. Selecting one column and finding a value
    By teco in forum Access Tables & Databases
    Replies: 1
    Last Post: 01-12-2017, 11:37 AM
  2. Selecting a subset based on other records
    By OmniBlue in forum Excel General
    Replies: 1
    Last Post: 03-22-2016, 05:36 PM
  3. VBA for finding max from groups of cells
    By kelly86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-17-2014, 11:18 AM
  4. Replies: 2
    Last Post: 09-25-2013, 09:53 AM
  5. Finding the first item in a subset
    By NumeroUno in forum Excel General
    Replies: 10
    Last Post: 06-17-2013, 09:08 AM
  6. Selecting a subset of rows from a table based on value in first field?
    By Kimberlily307 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-02-2012, 11:25 PM
  7. [SOLVED] Selecting a subset of items from a list
    By Steve in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-31-2006, 08:53 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