Results 1 to 4 of 4

Get average of some cells of a column If criteria in a different column with vba not worki

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-11-2010
    Location
    Minneapolis, USA
    MS-Off Ver
    Excel 2016
    Posts
    308

    Get average of some cells of a column If criteria in a different column with vba not worki

    I need the average of cells in col C for all the cells in col B that have 1
    Then the average of cells in col C for all the cells in col B that have 2
    .
    .
    .

    I have the following but it in not calculating the averages correctly, I have uploaded a file with data

    Thanks

    Sub Avarage_n()
    Dim ws As Worksheet
    Dim lRow As Long
    
        Set ws = ThisWorkbook.Sheets("Connections")
        lRow = ws.Range("A" & ws.Rows.Count).End(xlUp).Row
           
           With ws.Range("E2:E" & lRow)
                .Formula = "=IF(B2<>B1,AVERAGEIFS(B:B,C:C,C2),"""")"
                .Value = .Value
           End With
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 03-10-2014, 04:09 PM
  2. [SOLVED] =Average a whole column but only if criteria is met ?
    By ryefield in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-01-2013, 02:41 AM
  3. Replies: 14
    Last Post: 06-14-2013, 09:00 PM
  4. Can you do a average with criteria from another column?
    By dredd2525 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-24-2013, 04:36 AM
  5. Average range of cells in column if values in adjacent column are equal
    By RyNye in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-09-2012, 10:12 AM
  6. [SOLVED] Create a formula to add cells in one column if it meets the criteria for another column
    By Tamarissa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-23-2012, 11:27 AM
  7. Replies: 0
    Last Post: 07-22-2012, 01:05 PM
  8. [SOLVED] calculate average in a column based on criteria in another column
    By sharon t in forum Excel General
    Replies: 2
    Last Post: 05-12-2006, 01:10 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