+ Reply to Thread
Results 1 to 1 of 1

Median multiple criteria vba

  1. #1
    Registered User
    Join Date
    02-23-2016
    Location
    Algiers, Algeria
    MS-Off Ver
    2007
    Posts
    1

    Cool Median multiple criteria vba

    Hello ,

    I calculated the median with multiple criteria, the calculation is slow I wanted to make it with vba because calculation could be faster.

    The exercise which I linked it is just an example. The slow execution is on my real file which contains 11 offers and more than 3 thousands lines.

    The formula for the calculation:
    IFERROR(MEDIAN(IF(($A$2:$A$44=$N$1)*($E$2:$E$44=J$2)*($B$2:$B$44=$I3)*($F$2:$F$44=$M$1);$G$2:$G$44));"")

    validate with Ctrl + shift + enter

    I tried this VBA code but it does not work

    Sub MEDIAN()

    For Each cell In Range("J3:L9")

    year = Range("m1")
    offer = UCase(Range("n1"))
    month = UCase(Cells(2, cell.Column))
    day = UCase(Cells(cell.Row,9))

    cell.Value = Application.Evaluate("MEDIAN(IF((" & _
    offer & "=R1C14)*(" & _
    day & "=RC9)," & _
    month & "R2C)," & _
    year & "=R1C13)," & _
    C7 & "))")

    Next cell
    End Sub

    the link is : https://onedrive.live.com/redir?resi...nt=file%2cxlsx

    Thanks for helping me
    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)

Similar Threads

  1. Replies: 1
    Last Post: 02-15-2016, 04:35 PM
  2. Trying to find median & average for multiple columns with multiple criteria
    By help-meplease in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-11-2016, 06:59 PM
  3. YTD Median using Multiple Criteria
    By Decatur83 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-07-2013, 09:00 AM
  4. median if with multiple criteria
    By coffee_man in forum Excel General
    Replies: 2
    Last Post: 10-20-2011, 06:36 AM
  5. [SOLVED] calculate a MEDIAN using multiple criteria?
    By MetricsShiva in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  6. [SOLVED] calculate a MEDIAN using multiple criteria?
    By MetricsShiva in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 09:05 AM
  7. calculate a MEDIAN using multiple criteria?
    By MetricsShiva in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM

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