+ Reply to Thread
Results 1 to 12 of 12

Match function question

  1. #1
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114

    Match function question

    Is there a way to use the match function but for it to skip the first match found and look for the second or third match?

    What I've got so far is a formula that first uses the large function to find the first, second, third, etc... highest number in a column. I then use the match function to locate how many rows down it is at. The problem I've got is that sometimes there's an identical number in the data list. The large function will say the same number is the third and fourth highest number in the data list but the match function will only find the first value listed so it finds the same row value for the third and fourth highest number. Thanks in advance for any help

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Say your data is in A2:B10

    and you list the Largest values from A2:A10 in ascending order in C1:C5,

    Then use formula in D1:

    Please Login or Register  to view this content.
    confirmed with CTRL+SHIFT+ENTER and copied down.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114
    The way my workbook is setup is like this. There are two sheets, one that I paste a data list into that contains an item name, price, unit and sales total.

    Please Login or Register  to view this content.
    The second sheet takes that data and creates a top 20 list based on most units. Currently I'm using a formula that uses the following functions:
    1. Large - finds the first, second, third, etc.. highest unit total
    2. Match - takes the large function result and finds the row #
    3. Index - takes the match # for the row# and I change the column # to display the item name, price, units, and sales

    The problem I've run into is that when items have the same unit total, the match function won't work properly. As an example, say the second and third highest unit totals were both 23. The large function will give a value of 23 for the second and third highest values. The match function will then go and search for the #23 and find the first instance of it. The match function will then display the same exact row # for the second and third highest value. I need a way for the match function to skip the first instance of the # if it had just found that number.

    This is the formula I've go so far:

    =INDEX('Data Sheet'!$A:$D,(MATCH(LARGE('Data Sheet'!$C:$C,3),'Data Sheet'!$C:$C,0)),3)

    This is finding the third largest number in column C, then finding the row #, then index looking up that row # in column 3 (i.e. C) which displays the third highest unit total.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    So you didn't see/try my suggestion?

    Try to adapt it to your data.

  5. #5
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114
    I don't understand how you have your formula setup in relation to my data. I was also hoping not having to alter my formula too much.

    Say I wanted to test it out with just item names in column A and total units in column B with data then rearranged to display the top 5 units with the item name in column C and the unit total in column D. Thanks

  6. #6
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    It would help if you actually post a sample spreadsheet attachment....

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Weasel,

    Please read forum rules below and then add the link to the cross post

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  8. #8
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Man! After wasting my time on 3 different questions... those others were probably x-posted too!

  9. #9
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114
    I only posted in the another forum after I wasn't figuring it out here. I'm at a deadline to get this done and I figured I'd ask another site in case they knew. I still don't have a solution yet and I'm desperate. Thanks

  10. #10
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Weasel,

    Not looking for excuses just the link to the cross post and confirmation you have read and understand the rules below

    VBA Noob

  11. #11
    Forum Contributor
    Join Date
    09-13-2005
    Posts
    114
    I've cross-posted this topic here:

    http://www.mrexcel.com/forum/showthr...96#post1582896

    I've read the forums rules page and if I ever post in multiple forums I will make sure to display the url to the cross-post. Thanks

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    My formula will do that for you... you can't use the Match() function and Index() function like you suggest...

    Try adapting my formula by reading my post carefully and adjusting to ranges and references to suit your data.

    Remember that it must be then confirmed with CSE keys.

+ 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