+ Reply to Thread
Results 1 to 11 of 11

lookup formula

  1. #1
    Registered User
    Join Date
    03-18-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    6

    lookup formula

    I have a spreadsheet of soccer results. I would like to create a lookup formula of some kind that sums the goals scored by a team in the last five matches. So it should somehow be based on the date, as it should only include the five most recent matches, not matches played before that.

    Any suggestions?

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,921

    Re: lookup formula

    You don't really need a lookup, because you are not searching for a value. You can probably do this with some combination of SUMIF, COUNT, INDEX. But we need to know a little more about how your data is organized. Does your workbook deal with multiple teams? What data, and what columns is it in?

    I am not sure your title matches your question; you might consider changing it to something like "Sum five most recent events".
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,053

    Re: lookup formula

    Basically something like: =SUMIFS(C1:C20;A1:A20;">=10.3.2010";B1:B20;"a")

    But this has several problems: you need to enter 5th dat manualy (of course, you can use some aditional cells like D1 for date and D2 for club)

    =SUMIFS(C1:C20;A1:A20;">="&D1;B1:B20;D2)

    But best way would be that you upload some example workbook with some example data
    Never use Merged Cells in Excel

  4. #4
    Registered User
    Join Date
    03-18-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    6

    Sum five most recent events

    Thx for the replys. I am not at my home comp at the moment. I will upload an example workbook sometime tonight.

  5. #5
    Registered User
    Join Date
    03-18-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: lookup formula

    Here is my workbook, cleansed of unnecesary data.

    For any given match, I would like to sum up each teams scored goals in the five most recent matches.
    Attached Files Attached Files

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: lookup formula

    see this virtually identical thread from a few days ago: http://www.excelforum.com/excel-prog...lculation.html

    (there is an attachment in one of the last posts showing a formulae based approach)

  7. #7
    Registered User
    Join Date
    03-18-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: lookup formula

    Thank you, that was just what I was looking for and for the same purpose.

    For some reason, I cant get it to work on my spreadsheet though. I have uploaded my try, please check what I am doing wrong. It seems to me that the columns L and M are messed up, I just cant figure out why.
    Attached Files Attached Files

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: lookup formula

    The other thread was based on results in the reverse order to yours - ie most recent listed first.

    For the opposite - using your file:

    Please Login or Register  to view this content.
    Note L & M are both Arrays... as per instructions you must ensure you commit using CTRL + SHIFT + ENTER as opposed to Enter as per "normal" formulae.

  9. #9
    Registered User
    Join Date
    03-18-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: lookup formula

    Thanks I got it working now. The last result of the other post was in the same order as mine though.

    One last thing I only want it to show a result if the team has actually played 6 matches and otherwise it should show False or something similar. Or should I post this in a new thread?

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: lookup formula

    I would suggest you modify the formulae in L & M such that less than 6 results generates an error .... so replace:

    MIN(6;COUNTIF($B3:$C$500;$B2))

    with

    6

    in both L & M formulae - remember to reset the Arrays with CTRL + SHIFT + ENTER once modified.


    Note that there is an error in the previously suggested formula will need to be corrected, I2 should read:

    ISNUMBER($M2)

    and not L2 as is presently the case.

  11. #11
    Registered User
    Join Date
    03-18-2010
    Location
    Copenhagen
    MS-Off Ver
    Excel 2007
    Posts
    6

    Solved - lookup formula

    It works great, thanks a lot!!! i consider the subject solved.

+ 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