+ Reply to Thread
Results 1 to 10 of 10

find blank cells in column and average the cells below

  1. #1
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    find blank cells in column and average the cells below

    Hello,

    I have a worksheet that has some data that is a copy and paste from 2 different sheets. We calculate the percentage complete and then manually calculate the differences. I need some help in creating a macro to automate this process. Can someone please help.
    Attached is a sample worksheet with "Sample" as the worksheet with the data and "Result" is what I am trying to achieve.

    I want to be able to find the first blank cell in column E and then calculate the average of all the digits before the next blank cell is found and so on.
    The rows between the blanks will vary based on the month and the week the report is run but will always have a blank cell before the data for the next person. The format will remain the same though.

    Then, as per the results worksheet.
    1. Insert 3 columns for Target % (E), Distribution % (F) and the Difference in % (G).
    2. Calculate the average percentage for Distribution in Column (H).
    3. Values in Column F are essentially copy of calculated values from column (H).
    4. Column E is the % complete using the formula for Column (D) and (E).
    5. And finally column G is the difference between column (E) and (F).

    I part I am struggling the most is the calculations in column (H).

    I really appreciate your help.

    I have also asked this questions here
    Attached Files Attached Files
    Last edited by desibabuji; 12-31-2012 at 03:12 PM.

  2. #2
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: find blank cells in column and average the cells below

    So far, I was able to get to solve the "find empty column and average" part by this code. Can anyone please help me with the rest of it ie steps 3, 4 and 5?

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: find blank cells in column and average the cells below

    Pl see the attached file.
    You don't need Macro.See formulas in F, G & H columns.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: find blank cells in column and average the cells below

    Thanks for the reply. The formula works .

    But with the formula doesn't it mean that I have to copy and paste the formula for column F,G and H every time we get a new report? And the number of rows changes for every report, like in this sample it was 18 rows but some reports can have thousands of lines. Format does not change only the number of rows change.

    That's why I was trying to automate so as to avoid the manual copy and paste and entering the formula? Can this be automated so that running the macro inserts the formula in the columns and does the calcuations? Thanks for your help.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: find blank cells in column and average the cells below

    You have to copy and paste formula every time.The array formula after entering the formula you should press ctrl+Shift+ Enter key not simply enter key.You can drag formula till the last row.

    In the attached file Macro "Paste_Formula" will paste all formulas for all rows. You need not do it manually.
    Attached Files Attached Files
    Last edited by kvsrinivasamurthy; 12-30-2012 at 10:21 AM.

  6. #6
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: find blank cells in column and average the cells below

    Thanks again for your help. I think we are really close to the solution but not there yet totally

    When I run the Macro for the formula it stops calculating after row 18 (I have attached the file with example sheet New Sample). I think it is because of the E18 in the formula:

    Please Login or Register  to view this content.
    Can it be made into a variable so that it goes all the way from the first to the last row with data, because the number of rows will vary based on the week and month the report is run?

    And also, is it possible to only copy the formula and not the formatting because it formats the whole column (as in the sheet).

    Thanks again for your help, I really appreciate it.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: find blank cells in column and average the cells below

    Bumping to see if anyone can help please !

    I think the solution is almost there, just need some help in changing the formula to use dynamic range instead of hard set values for the number of rows. Any one please !

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: find blank cells in column and average the cells below

    I'm afraid your post does not comply with Rule 8 of our Forum RULES. Cross-posting is when you post the same question in other forums on the web. You'll find people are disinclined to respond to cross-posts because they may be wasting their time solving a problem that has been solved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser)to the cross-post. Expect cross-posts without a link to be closed a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).
    HTH
    Regards, Jeff

  9. #9
    Registered User
    Join Date
    09-27-2012
    Location
    Orange County, CA
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: find blank cells in column and average the cells below

    Thanks Jeff. Got it. Will comply. Also added the link to the other thread.

  10. #10
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,577

    Re: find blank cells in column and average the cells below

    Sorry for the delay, because I was out of station.

    If your problem is not yet solved pl see the attached file with macro. It may help you.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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