+ Reply to Thread
Results 1 to 6 of 6

If/then statement that checks multiple columns then averages?

  1. #1
    Registered User
    Join Date
    11-10-2015
    Location
    Wisconsin
    MS-Off Ver
    2010
    Posts
    3

    If/then statement that checks multiple columns then averages?

    I'm working on consolidating a data set right now that has 55 subjects with multiple variables per subject to enter into SPSS for regression analysis. I have multiple data points per variable per year, and what I'm trying to do is get the averages for each type of variable per year per subject.

    Each year is set to start at 0, and I have 8 variables (phosphorus, nitrogen, dissolved oxygen....etc) that are all text fields. Is there a way to write a function (or macro, just less familiar with those) that has Excel check column A for what year, then column B for which variable, to get one cell that averages the phosphorus total within that one year?

    Since I have so many subjects, and each subject has 40 years of data, I'm trying to not do this by hand if at all possible.

    Huge thanks to whomever can help with this! Screenshot of example data is below.
    Attached Images Attached Images
    Last edited by kixgil; 11-10-2015 at 04:30 PM. Reason: Whoops, got my name in there

  2. #2
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: If/then statement that checks multiple columns then averages?

    try
    Please Login or Register  to view this content.
    If your questions has been answered to your satisfaction please don't forget to do the following:

    Add Reputation ... and ... Mark Thread as Solved

    Thanks,

    Ma 10:8b Freely you have received; freely give.

  3. #3
    Registered User
    Join Date
    11-10-2015
    Location
    Wisconsin
    MS-Off Ver
    2010
    Posts
    3

    Re: If/then statement that checks multiple columns then averages?

    Thanks! I'll try that.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: If/then statement that checks multiple columns then averages?

    Welcome to the forum kixil

    Please upload a sample of your workbook, not a picture of your data. Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you
    Also, not all members can upload picture files (Company firewalls and stuff) - and, depending on what browser is being used, some pics dont even show up on the forum

    Your workbook should show a small desensitized example of the data you are working with and a manual mockup of the expected results.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Registered User
    Join Date
    11-10-2015
    Location
    Wisconsin
    MS-Off Ver
    2010
    Posts
    3

    Re: If/then statement that checks multiple columns then averages?

    So that command is giving me a VALUE error....not entirely sure why. Exact formula: =AVERAGEIFS(AllLAkesData!D2:D104693, AllLAkesData!B2:B104693, 0, AllLAkesData!A2:A104693, "Amnicon", AllLAkesData!C2:CC104693, "TKN"), with column A being the lake name, column D containing the numerical data, column B the recoded year (0 being starting year), and column c being the parameter name. The average range contains only numbers, I have no idea where the error could be. And I get the error every year, and I know I have data for most of the years for this parameter.

    Is something in my formula incorrect?

    FIGURED IT OUT. Damn thing kept selecting when I wasn't clicking, so an extra letter snuck in. Oif.
    Last edited by kixgil; 11-14-2015 at 09:53 PM.

  6. #6
    Forum Contributor mongoose36's Avatar
    Join Date
    06-10-2013
    Location
    Lincoln
    MS-Off Ver
    Excel 2013
    Posts
    389

    Re: If/then statement that checks multiple columns then averages?

    oops my apologies I got the arguments reversed in my formula.
    Please Login or Register  to view this content.

+ 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] If Statement that checks two cells
    By Richard_Thornton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-22-2015, 08:50 AM
  2. Replies: 0
    Last Post: 11-21-2014, 05:00 PM
  3. [SOLVED] I need help plotting averages of data based on multiple columns
    By soundengineer in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-12-2014, 07:21 PM
  4. [SOLVED] Weighted Averages an multiple columns
    By Butcher1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-23-2013, 01:41 PM
  5. Averages across multiple Columns
    By Simon M in forum Excel General
    Replies: 5
    Last Post: 04-29-2011, 02:21 AM
  6. Replies: 1
    Last Post: 05-02-2008, 10:41 AM
  7. COUNTIF statement with 3 criteria checks
    By Malvaro in forum Excel General
    Replies: 4
    Last Post: 06-04-2006, 06:45 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