+ Reply to Thread
Results 1 to 12 of 12

How to average certain Columns??

  1. #1
    Registered User
    Join Date
    10-27-2015
    Location
    CT, USA
    MS-Off Ver
    2010
    Posts
    36

    How to average certain Columns??

    Hello, I am In a bind.

    Process: Import new data from .CSV file.
    Data is 6000 + rows. Same # of columns.
    Sort "Status" to only have PASS.
    Sort "Part Number"
    Lastly... Average Each "Part Number" values in "Sheet2"


    Only need values from certain Columns. They Are Columns;
    C,F,G,H,L,M,N,O,P,Q,R,S,T,U,V,W = 16 COLUMNS Total.


    I have it set to if you click on "PartNumber" or "Status", They sort accordingly to the enabled Macro.
    New Data.xlsm
    Let me know if there is anything I can clear up?

  2. #2
    Registered User
    Join Date
    10-27-2015
    Location
    CT, USA
    MS-Off Ver
    2010
    Posts
    36

    Re: How to average certain Columns??

    Anyone able to help?

  3. #3
    Registered User
    Join Date
    10-27-2015
    Location
    CT, USA
    MS-Off Ver
    2010
    Posts
    36

    Re: How to average certain Columns??

    The process is basically complete, with VBA code included in file. Only problem I have is trying to average specific columns as opposed to say columns B:W directly. I only need the columns specified above. How do I implement in the code to only average those columns?

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: How to average certain Columns??

    Hi rmrjr22

    Assuming your existing Code works (almost) replace Sub AverageCalc() with this...
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to average certain Columns??

    Have you considered just making a Pivot Table of averages for the specific columns?
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  6. #6
    Registered User
    Join Date
    10-27-2015
    Location
    CT, USA
    MS-Off Ver
    2010
    Posts
    36

    Re: How to average certain Columns??

    Thank you immensely jaslake!
    The numbers dont match up to the column titles though.
    For example:
    Values in columns F,G, H Should be one more to the left. "Failure code" is Empty.
    And the same for Columns L:W. Should all be shifted one column to the left.
    All column titles are fine.
    Also values in Status column are not necessary.

    Just tried changing it myself and kept on getting "Running Error".
    What do I need to change?

  7. #7
    Registered User
    Join Date
    10-27-2015
    Location
    CT, USA
    MS-Off Ver
    2010
    Posts
    36

    Re: How to average certain Columns??

    Quote Originally Posted by AlphaFrog View Post
    Have you considered just making a Pivot Table of averages for the specific columns?
    Yes AlphaFrog, but the best layout is a mirror image of the input data from the CSV file. There are way more unique "Part Numbers" to sort through, and better to have the data visible in landscape mode.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: How to average certain Columns??

    Hi rmrjr22

    As I said "almost"...try this...
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    10-27-2015
    Location
    CT, USA
    MS-Off Ver
    2010
    Posts
    36

    Re: How to average certain Columns??

    haha yeah, "Almost". I caught that.
    The code performed B-e-a-u-t-i-f-u-l-l-y!
    In the new code, you told the column count (ii) to take a step back?

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: How to average certain Columns??

    Yes...exactly...
    In the new code, you told the column count (ii) to take a step back?

  11. #11
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: How to average certain Columns??

    Quote Originally Posted by rmrjr22 View Post
    Yes AlphaFrog, but the best layout is a mirror image of the input data from the CSV file. There are way more unique "Part Numbers" to sort through, and better to have the data visible in landscape mode.
    This puts the Pivot Table on sheet 3 for testing.

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    10-27-2015
    Location
    CT, USA
    MS-Off Ver
    2010
    Posts
    36

    Re: How to average certain Columns??

    Thankyou AlphaFrog. I didnt know the full capabilities of a pivot table. It does have unique properties to display the information clearly. Playing around with it now to get a more detailed look for the presented data.

+ 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. [SOLVED] Average of the Max value of 2 Columns
    By DeZeeuw2 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 03-13-2015, 09:25 AM
  2. average formula in excel with even columns only and columns with no value
    By DANNYH765 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-26-2014, 08:12 PM
  3. [SOLVED] getting the average of only some columns
    By boxofrain in forum Excel General
    Replies: 7
    Last Post: 02-20-2014, 08:44 PM
  4. Average of different columns
    By TallOne in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-13-2013, 04:09 PM
  5. Average of different columns
    By TallOne in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-12-2013, 10:01 AM
  6. Average of last 3 columns
    By Joanne R. in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-03-2006, 05:25 PM
  7. Average of last 3 columns
    By CRIMP in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-18-2005, 03:01 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