+ Reply to Thread
Results 1 to 7 of 7

need a quick way to enter a formula—that changes every 55 rows—into 45K rows

  1. #1
    Registered User
    Join Date
    10-20-2015
    Location
    WA, USA
    MS-Off Ver
    Excel for Mac 2011
    Posts
    4

    Question need a quick way to enter a formula—that changes every 55 rows—into 45K rows

    I'm writing a formula that will be repeated down column B of a table. The formula sums 55 values in column A of data, and finds the percentage of that sum the current parallel cell in column A represents.

    There are 45,000 rows in the table.

    The formulas in column B need to sum the first 55 cells of column A, and then starting in cell B56, the formula for the next 55 rows needs to sum cells A56 through A111, and then update to sum the next 55 values in the column when it reaches cell B112, and continue to update to reflect the sum of the next 55 rows until the last row.

    Below are the first three formulae, from cells B2, B3, and B4:
    =A2/(SUM($A$2:$A$56))
    =A3/(SUM($A$2:$A$56))
    =A4/(SUM($A$2:$A$56))

    Below is the formula in cell B56:
    =A57/(SUM($A$57:$A$111))

    I'd like to Use Edit > Fill > Down to enter all the formulae into the 45,000 rows of data, but because the sum function has to be identical for 55 rows, and then be updated to a new range for the next 55 rows, I can't.

    Is there a way to enter the correct, changing formula in all the cells of column B without copying and pasting 55 cells at a time?

    Thanks for any help you can offer!

    - LCamille

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: need a quick way to enter a formula—that changes every 55 rows—into 45K rows

    Probably yes. But if you could upload a sample Excel file (with desensitized "dummy" data) with say 100 rows or so it would be helpful.

    Edit Sorry. My bad.

    If you are not familiar with how to do that:

    To attach a file to your post,
    click “Go Advanced” (next to Post Quick Reply),
    scroll down until you see “Manage Attachments”,
    click that and select “Add Files” (top right corner).
    click on “Browse”
    select your file(s)
    click “Open” click “Upload” click “Done” (bottom right)
    click “Submit Reply”
    Once the upload is completed the file name will appear at the bottom of your reply.
    Last edited by FlameRetired; 10-21-2015 at 12:19 AM.
    Dave

  3. #3
    Registered User
    Join Date
    10-20-2015
    Location
    WA, USA
    MS-Off Ver
    Excel for Mac 2011
    Posts
    4

    Re: need a quick way to enter a formula—that changes every 55 rows—into 45K rows

    Added an example file. Thanks!
    Attached Files Attached Files

  4. #4
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: need a quick way to enter a formula—that changes every 55 rows—into 45K rows

    The attached has two possible solutions. In Sheet1 I "shadowed" your column B formula with one that does what you want every 20 rows. Adapt the numbers to suite the 55 rows. The formula in C2 and copied down is
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    It creates a kind of "traveling" range as you copy down and changes the 20 (55) row range reference every 20 rows. It sums them in each row, divides column A by that and then multiplies 40.


    In Sheet2 an alternative would be to place the sums every 20 (in life 55) to make a helper column. This saves Excel having to use the SUM function each row. With 45000 rows I suspect you will want all the performance edge you can get. In Sheet2 the helper (column C) starting in C21 is
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Be sure to maintain the relative cell addressing. Then copy C2:C21 and paste below in C22. Then copy and paste those 40 rows and repeat. If you are not familiar with doubling effects don't be intimidated. This should take no more than about 10-11 re-doublings of the 55 rows to complete the 45000. Then the formula in B2 would be
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    for 20 rows. The advantage of this is that the formula references the sum rather than having to recalculate it every row.

    Let us know what you think.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2404
    Posts
    13,406

    Re: need a quick way to enter a formula—that changes every 55 rows—into 45K rows

    Another way to do the helper column instead of the copy / paste would be with this formula in the helper column.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I don't know why I didn't think of it before. Sorry.

  6. #6
    Registered User
    Join Date
    10-20-2015
    Location
    WA, USA
    MS-Off Ver
    Excel for Mac 2011
    Posts
    4

    Re: need a quick way to enter a formula—that changes every 55 rows—into 45K rows

    Column C worked beautifully! Didn't take 2 minutes, so I'd done it before I saw your update.

    But column B gives me a #Div by 0! error as soon as I drag the formula past the first 55 rows. I'm not familiar with either index or ceiling, but I'll research both of those to see what I've done wrong. Here's how I modified your formula in order to fit the top cell of my actual spreadsheet:

    =AF2/INDEX($AH$2:$AH$44936,55+(CEILING(ROWS($1:1)/55,1)-1)*20)*40

    Here's what it looks like in the first cell where it gives me a #Div by 0! error:

    =AF57/INDEX($AH$2:$AH$44936,55+(CEILING(ROWS($1:56)/55,1)-1)*20)*40

    Thanks again for your help!

    - LCamille

  7. #7
    Registered User
    Join Date
    10-20-2015
    Location
    WA, USA
    MS-Off Ver
    Excel for Mac 2011
    Posts
    4

    Re: need a quick way to enter a formula—that changes every 55 rows—into 45K rows

    Ah, I see I needed to change the last 20 to a 55 as well, and then I get accurate calculations! Thank you so much. This was a great quick fix for what looked like a several hour copy-paste issue.

    - LCamille

+ 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. Is there a quick way to insert rows?
    By JJ2k10 in forum Excel General
    Replies: 1
    Last Post: 07-25-2014, 05:47 AM
  2. Quick short cut for formulas in rows
    By ACrossley1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-16-2014, 10:17 AM
  3. [SOLVED] Enter Sum Formula after adding Rows
    By smartbuyer in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 08-08-2013, 08:03 AM
  4. [SOLVED] Enter a sum formula in each of an unknown number of rows - macros
    By ahilty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2013, 04:07 PM
  5. Replies: 1
    Last Post: 07-18-2012, 04:49 AM
  6. A quick way to insert rows
    By madadd in forum Excel General
    Replies: 2
    Last Post: 03-31-2011, 05:43 PM
  7. using a macro to enter formula in reports with variable rows
    By laurajo1218 in forum Excel General
    Replies: 2
    Last Post: 06-26-2009, 12:17 PM

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