+ Reply to Thread
Results 1 to 8 of 8

How to get excel to recognize pattern

  1. #1
    Registered User
    Join Date
    06-17-2013
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    37

    How to get excel to recognize pattern

    Hi,

    I have been working on a complex spreadsheet and am wondering how to insert a pattern.

    Let's say that A1 is the sum of 4 columns of data, BC7:BG7.
    I know that B1 will SKIP TWO columns and then be the sum of the next four columns after that. (BJ7:BM7).
    C1 will skip two more columns and be the sum of the next four columns (BP7:BS7).
    And so on and so forth.

    Is there a way to get excel to realize what I am trying to do without taking all of the sums manually? Thanks so much for your help!!!

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to get excel to recognize pattern

    Do you also want to change the no of columns being summed?
    If posting code please use code tags, see here.

  3. #3
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to get excel to recognize pattern

    The logic of the incriments in your post is flawed, it's not consistent.

    You said sum of 4 columns BC7:BG7 (that's actually 5 columns)
    Then the next one is BJ7:BM7 (that IS 4 columns)

    So if you actually meant sum 4 columns and skip 2 then sum next 4, and they are
    BC:BF
    BI:BL
    BO:BR
    etc..

    Try
    =SUM(OFFSET($BC7:$BF7,0,(COLUMNS($A1:A1)-1)*6))

  4. #4
    Registered User
    Join Date
    06-17-2013
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: How to get excel to recognize pattern

    I'm sorry. I actually meant BC:BF, BI:BL, BO:BR, and so on. And it will always be four columns each time. Unfortunately, the code you provided seems to be summing BC:BF each time. It is a great starting point though, thanks!

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to get excel to recognize pattern

    The formula jonmo posted works for me when I copy it across A1, B1, C1 etc.

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to get excel to recognize pattern

    Quote Originally Posted by Angelfish13 View Post
    I'm sorry. I actually meant BC:BF, BI:BL, BO:BR, and so on. And it will always be four columns each time. Unfortunately, the code you provided seems to be summing BC:BF each time. It is a great starting point though, thanks!
    The formula itself won't show the $BC7:$BF7 change to $BI7:$BL7
    But using offset, it actually sums the correct ranges as you described.

  7. #7
    Registered User
    Join Date
    06-17-2013
    Location
    Denver, Colorado
    MS-Off Ver
    Excel 2010
    Posts
    37

    Re: How to get excel to recognize pattern

    You are right! The code is working perfectly I think I copied I pasted the code wrong the first time. Thank you so much for your help!!!

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to get excel to recognize pattern

    You're welcome, thanks for the feedback.

+ 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