+ Reply to Thread
Results 1 to 12 of 12

To Sum and Count several blocks of Data

  1. #1
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    To Sum and Count several blocks of Data

    ScreenHunter_001.jpg

    B2:G9 contains 6 blocks of data with label TA, TB & TC.
    B11:D16 shows the count and sum results for all the 3 labels.

    What are the formulas in D11:D16 ?
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: To Sum and Count several blocks of Data

    Hi,

    This is clearly a much simplified example and probably doesn't represent the size of your actual data. We often find that when we give an answer to what is a trivial non representative example when the solution is used with the real world data it doesn't work because of factors like string length and other stuff which is important but hasn't been mentioned.

    Therefore upload your real workbook (or at least a cut down copy), and manually add the results you expect to see.

    For instance are all the blocks always a 2x4 matrix
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: To Sum and Count several blocks of Data

    Hi Richard,

    The cut file attached
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: To Sum and Count several blocks of Data

    Please Login or Register  to view this content.
    Change highlighted cells if block size not 7 X 4
    Attached Files Attached Files
    Last edited by JohnTopley; 01-22-2017 at 07:07 AM.

  5. #5
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: To Sum and Count several blocks of Data

    Thank you John, it works.

    Any method other than running a macro please?

  6. #6
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: To Sum and Count several blocks of Data

    There may be: Is there are finite (maximum) number of matrices (blocks of 7 x 4)? and if it could be done would you accept using "helper" columns/rows?

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: To Sum and Count several blocks of Data

    Removed: duplicate incomplete!!!
    Last edited by JohnTopley; 01-22-2017 at 11:22 AM.

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: To Sum and Count several blocks of Data

    Using helper columns/rows: Sheet1

    In AV2: Calculates the sum of numbers in each matrix

    =IFERROR(SUMPRODUCT((OFFSET($A$1,($AU2-1)*7+1,(AV$1-1)*4+1,7,4))),"")

    Copy across and down

    In AV5: determines the "flag" i.e. "TA" etc

    =OFFSET($A$1,($AU5-1)*7+7,(AV$1-1)*4+1,1,1)

    in Av8: counts the number of non-zeros in each matrix


    =IFERROR(COUNTIF((OFFSET($A$1,($AU8-1)*7+1,(AV$1-1)*4+1,7,4)),">0"),"")

    in Aw12

    =SUMPRODUCT(--($AV$5:$BF$6=$AV12)*($AV$8:$BF$9))

    Copy down

    in AX12

    =SUMPRODUCT(--($AV$5:$BF$6=$AV12)*($AV$2:$BF$3))

    Copy down
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: To Sum and Count several blocks of Data

    Te attached has "helper" calculations in Sheet3 and results table in Sheet2.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: To Sum and Count several blocks of Data

    I don't mind using helper. I'll try when I'm available and give you reply.

    Thanks John.

  11. #11
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,180

    Re: To Sum and Count several blocks of Data

    See post #9.

  12. #12
    Forum Contributor
    Join Date
    07-24-2013
    Location
    HongKong
    MS-Off Ver
    Excel 2010
    Posts
    237

    Re: To Sum and Count several blocks of Data

    Quote Originally Posted by JohnTopley View Post
    See post #9.
    John,

    As the number of matrices varies from time to time, using helper cells seems not applicable to my case. I prefer the macro you provided.

+ 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. Auto Count Hour Blocks?
    By jmrlifesafe in forum Excel General
    Replies: 11
    Last Post: 02-17-2016, 09:39 AM
  2. [SOLVED] Count Blocks of occurances within a range
    By Chanter in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 02-09-2016, 05:01 AM
  3. [SOLVED] Need a formula to count blocks of data
    By john dalton in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 04-15-2015, 08:57 AM
  4. [SOLVED] Grouped Data Blocks editted to Columns of Data based off left cell value?
    By BlazzedTroll in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 06-10-2013, 03:06 PM
  5. Count blocks of cells that have a meet a ste value,
    By Tim Lord in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-16-2012, 06:50 AM
  6. Using macros to identify blocks of data and summarise those blocks
    By gophbeav in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2012, 04:35 AM
  7. How do i count blocks of data..???
    By drgogo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-27-2008, 12:17 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