+ Reply to Thread
Results 1 to 4 of 4

Averageifs, filtering first occurrence of a number in another column

  1. #1
    Registered User
    Join Date
    10-11-2021
    Location
    Lufkin, Texas
    MS-Off Ver
    365
    Posts
    5

    Unhappy Averageifs, filtering first occurrence of a number in another column

    I am tasked with maintaining a spreadsheet that contains a tab dedicated to averaging job hours for orders of a certain type when specific criteria are met. To date, I have just used the AVERAGEIFS command to filter and average only certain values (Between two dates and order type).

    The problem I am running into is the source data for the information skewing the overall averages (slightly) but enough to be a problem.

    The source data is copied into several lines as "tasks" for each job and the total number of hours for each job is copied with it so when I take averages the hours are considered by a factor of how many tasks each job has.

    For instance, job number 121 may have 3 tasks and the job has 12 hours. The 12 is copied 3 times in the AVERAGEIFS function. In another place job number 126 has 4 tasks and the job has 14 hours. The 14 is copied 4 times in the AVERAGEIFS function.

    Because we have over 3000 lines of tasks and other tabs that use the repeated data (setup prior to my arrival), I cannot just simply remove the copied values. Its kinda needed to make other stuff work.

    What I want to do is set a criteria where only the first occurrence of the job numbers will be indexed, the indexes matched to the other criteria in the AVERAGEIFS, and the number of resulting hours averaged.



    So something like this =AVERAGEIFS( HRS_RANGE, TYPE_RANGE, TYPE, DATE_COMPLETED_RANGE, ">="&DESIRED_START_DATE, DATE_COMPLETED_RANGE, "<"&DESIRED_END_DATE, JOB_NUMBER, --CRITERIA FOR ONLY FIRST OCCURANCE OF EACH JOB NUMBER-- )

    I can get the criteria to detect the 1st occurrence of the very first job and only consider that but I need it to detect ALL the first occurrences of EACH job number, like an indexed array or something.

    Please see attached spreadsheet with an 'example' of how this data might look like. I left the appropriate output value in the output "AVERAGE =" cell and put the AVERAGEIFS function that I am currently using just below it.

    Attached Files Attached Files

  2. #2
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,416

    Re: Averageifs, filtering first occurrence of a number in another column

    Try Cell E29 Array Formula

    Sorry, the forum firewall blocked me and prevented me from posting the formula, so I had to upload the formula in the attachment
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    10-11-2021
    Location
    Lufkin, Texas
    MS-Off Ver
    365
    Posts
    5

    Re: Averageifs, filtering first occurrence of a number in another column

    This worked FLAWLESSLY! I even tested it with a single cell and it counted it as well in the average. I modified the dates to DATE("year cell",1,1) and DATE("year cell"+1,1,1) in case anyone else wants to use this and wants the ability to ACTUALLY change the year lol.

    Thanks, again!

  4. #4
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,416

    Re: Averageifs, filtering first occurrence of a number in another column

    @sonyxmase You're Welcome. Glad to help . Thank You for the feedback

+ 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: 2
    Last Post: 02-06-2019, 05:49 AM
  2. Last occurrence of number in column
    By formexcel in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 07-21-2017, 08:31 AM
  3. averageifs usage with filtering
    By vconstantin in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-31-2016, 04:38 AM
  4. [SOLVED] Find 1st Occurrence of Number and Return Value In nth Column
    By esiegal in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-27-2015, 11:06 AM
  5. [SOLVED] Count number of occurrence in column and print to array
    By ggilzow in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-10-2013, 12:44 PM
  6. [SOLVED] Counting digit occurrence in number/column
    By tazdingomon in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2012, 02:35 AM
  7. [SOLVED] trouble filtering a list. Why isn't column filtering?-number of criteria
    By Pat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-18-2005, 11: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