Ask Experts Questions for FREE Help !
Ask
    jakester's Avatar
    jakester Posts: 582, Reputation: 165
    Senior Member
     
    #1

    Feb 5, 2013, 09:06 AM
    Large function and handling duplicate values
    Hi Jerry - been a long time, hope life is treating you well.

    Ok, so here is my problem. Every month I run a report that gives me a count of errors for different error codes. What I do is rank the top 5 error codes according to their counts. The error codes are like H10012 or H20631, etc. Every once in a while, though, different error codes will have the same the number of errors. The Large function simply repeats the first error code if it has the same number of errors as another code.

    Here's an example of the data

    1. H10012 20


    1. H10021 15


    1. H20631 20


    1. H30513 45


    1. H40512 35


    The codes are all in Column A and the counts can be in Columns B - M (Jan - Dec), depending upon the month that I am looking for (each month is in a different column). I'd rather avoid trying to use helper columns because I constantly change the number of columns and that would require a lot of work.

    Right now I am doing this in two stages. First, find the largest 5 values:

    Code:
    =LARGE(M:M,1)
    In this case, looking in Column M (Dec) and find the largest value. Second:

    Code:
    =INDEX(A:A,MATCH(LARGE(M:M,1),M:M,0))
    Return the corresponding error code associated with the largest value in Column M.

    Again, I look for the top 5 largest values. And in the above list, I'd like to have the sequence be:

    1. H10021 15


    1. H10012 20


    1. H20631 20


    1. H40512 35


    1. H30513 45


    But when I try to solve for this problem using Large, H10012 gets repeated twice because 20 appears twice. I found this formula out on the internet but I cannot get it to work properly. Probably because my pivot table doesn't start on row 1; the first error code starts on row A6:

    Code:
    =INDEX(A:A,MATCH(LARGE(D$1:D$500+(ROW(D$1:D$500)*0.0000000001),ROW(1:1)),D$1:D$500+(ROW(D$1:D$500)*0.0000000001),0))
    Any ideas?
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #2

    Feb 6, 2013, 12:44 PM
    Easiest would be to RANK the column M values first because you can resolve the ties within the RANK formula.

    Assuming the first value is in M2 (M1 being the title), put thie formula in N2 and copy down. It will rank the value and break ties by giving preference to the first time a value appears in column M. So the tied for 3rd would go to the first time the value appears, the second time it happens that rank will increment to 4.

    =RANK($M2,$M:$M)+ COUNTIF($M$1:$M2,$M2)-1

    Now copy that down.

    Last, the first formula you will use to grab the column A code that is the Rank1 in column N,

    =INDEX(A:A, MATCH(ROW(A1),N:N, 0))

    Copy that down and your ordered list will appear.
    jakester's Avatar
    jakester Posts: 582, Reputation: 165
    Senior Member
     
    #3

    Feb 7, 2013, 02:09 PM
    Thanks, Jerry, I went with a different approach but thanks for offering up yours... I'm sure it would work just fine. Incidentally, I'm having an issue with a VBA script I wrote so I'll start another thread to see if you can help with that.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search


Check out some similar questions!

Duplicate Values [ 5 Answers ]

Hi, How to identify the duplicate values in same sheet. Eg. A1,A2,A3,A1. Regards,

Finding indicated values for the function. [ 0 Answers ]

Hi Guys... Having trouble in my Algebra class understanding these types of questions: Find the indicated function value. f(x) = x + 5, g(x) = x - 7 Find (f + g)(2). ?

finding the indicated function values [ 0 Answers ]

Find f(4) when f(x)=x2+3x-7. That x to the second power. Idk how to make it small. Lol but I am having a hard time figuring out how to solve these equations.

Function indicated values? [ 3 Answers ]

G:x-2-(x) Answers: g(0) g(-2) g(2) g(-3) How do you find the right answer?

Finding indicated values for the function [ 12 Answers ]

the function of x f(x)=4x-7 a) f(3) b) f(-5) the teacher told my son a) was the right answer. Why? If I can understand how to solve, I can help him. thanks, ginger wages


View more questions Search