+ Reply to Thread
Results 1 to 4 of 4

Function for Finding the first 18 occurances of a text and averaging the first 18 values.

  1. #1
    Registered User
    Join Date
    03-02-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    2

    Question Function for Finding the first 18 occurances of a text and averaging the first 18 values.

    Hey everyone,

    I was wondering if someone would want to try to help me come up with a function that will find the first 18 occurrences of a text (in this case, the text is "Test") and then average the 18 associated values that are in a different column. There are two values in the text column, "Test" and "Standard", and they are not sorted by text so Test and Standard are all jumbled together (I can't sort them without causing some problems....at least I don't think I can.)

    Any help would be greatly appreciated!

    Thanks!

    Luke

  2. #2
    Registered User
    Join Date
    07-27-2012
    Location
    United States
    MS-Off Ver
    Excel 2010 /13
    Posts
    11

    Re: Function for Finding the first 18 occurances of a text and averaging the first 18 valu

    Not sure exactly what you are asking, but if just 2 columns can sort that easily enough. Use sort filter custom sort, highlight the columns you wish to sort together, sort by col a A-Z, add a second sort in the filter sort col B low to high

  3. #3
    Registered User
    Join Date
    03-02-2013
    Location
    Indiana
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Function for Finding the first 18 occurances of a text and averaging the first 18 valu

    Sorry for not being clear, an example of the data I have is

    Test 3
    Standard 4
    Standard 5
    Test 4
    Test 5
    Standard 6
    Test 1
    Standard 7


    I wanted a function that would find the first 18 instances of "Test" and then average the values in the second column that go along with the first 18 instances of "Test" However, I think I was wrong about not being able to sort it. I was afraid if I sorted by column one, the specific order in which the "Test"s show up in relation to each other would get messed up. It's important that it is the first 18 of the original non-sorted column. But looking at it now, I don't think that will be a problem, so I'll just go ahead and sort and manually find the first 18

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Function for Finding the first 18 occurances of a text and averaging the first 18 valu

    hi llvrooma, welcome to the forum. yes you can do the sorting indeed. but if you're still interested, maybe this array formula would help. assuming data in A2:B100:
    =SUM((A2:A100="test")*(ROW(A2:A100)<=SMALL(IF(A2:A100="test",ROW(A2:A100)),18))*(B2:B100))/18

    ...confirmed by pressing CTRL-SHIFT-ENTER to activate the array. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL-SHIFT-ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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