+ Reply to Thread
Results 1 to 7 of 7

Ranking of Positions and Hiding of Unused Rows in Calculated League Table

  1. #1
    Registered User
    Join Date
    11-17-2015
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    9

    Ranking of Positions and Hiding of Unused Rows in Calculated League Table

    Hi there

    Am working on a football statistics sheet and cannot seem to get the league positions correct in columns AE and AF of the Setting sheet - it works fine if every position has data - but for some leagues there are less teams in and so the rankings include the blank spaces.
    - Is there a way to exclude these unused rows to adjust the ranking order and then populate column AF with the final results?

    Also on the Main Table tab - i am looking to find a way to automatically hide unused rows when i select leagues of varying numbers of teams - i have absolutely no clue how i can do this if its possible.

    Its a work in a very early progress stage - so any help with these would be great!
    Sorry if some of my formulas are a bit wrong - i am kind of learning about excel as i go with this!
    Many thanks hopefully!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Ranking of Positions and Hiding of Unused Rows in Calculated League Table

    Hi,

    I'm not sure exactly what you want in AE, as there's no data there at the moment and I don't know what 'Alpha' means to you - sorry .

    However, here's how to get the rankings working.

    First, in AC3 and AD3, use these formulae, which will blank the cells if there's no team listed in C3:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    They're just simple IF statements to check for a blank in C3, with your formulae on the end - drag down to row 30 and you'll see rows 13-30 go blank. If you don't do this, you'll get some errors showing later - though they won't actually affect the results.
    You can do the same in columns D to AA - just add IF(C3="","", to the start of each formula and a close bracket ) at the end. Again, this is just aesthetic - the results won't be affected if you don't.

    Now the actual ranking - put this in AB3 and drag down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    It first checks if there's something in C3 (team name). If not, it returns a blank. If there is something in C3, then it does the ranking.
    Instead of specifying K3 to K30, the range for the ranking is set by starting at K$3 then offsetting by the number of rows from 3-30 which are greater than 0 - that is, it counts the rows containing something, then adds that to row 3.

    Now put this formula in AF3 and drag down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Because AB/AC/AD can be blank, this checks if you get an error from the calculation and gives you a blank instead of a #VALUE! error.

    Lastly, put this in B3 and drag down:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    The Rank function here is set up the same as that in AB3, plus there's a check if an error is returned, as in AF3.

    I hope that all makes sense - here's your file with the formulae applied: 2015-16 _ ranking for essxmark _ AS.xlsx
    Regards,
    Aardigspook

    I recently started a new job so am a bit busy and may not reply quickly. Sorry - it's not personal - I will reply eventually.
    If your problem is solved, please go to 'Thread Tools' above your first post and 'Mark this Thread as Solved'.
    If you use commas as your decimal separator (1,23 instead of 1.23) then please replace commas with semi-colons in your formulae.
    You don't need to give me rep if I helped, but a thank-you is nice.

  3. #3
    Forum Expert José Augusto's Avatar
    Join Date
    10-29-2014
    Location
    Portugal
    MS-Off Ver
    2013-2016
    Posts
    3,329

    Re: Ranking of Positions and Hiding of Unused Rows in Calculated League Table

    Hi

    See the file 2015-16(1).xlsx and verify if is that you want.

  4. #4
    Registered User
    Join Date
    11-17-2015
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Ranking of Positions and Hiding of Unused Rows in Calculated League Table

    Hi Aardigspook and Jose

    Yes that has sorted it exactly as i was looking for - both your solutions have solved that issue - thank you so much!!

    Is there any simple way of solving the 2nd part that you know of - hiding the unused rows automatically on the Main Table?
    Or is that something requiring a Macro or VBA (not that im totally sure what either of them are!)

  5. #5
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Ranking of Positions and Hiding of Unused Rows in Calculated League Table

    There isn't a formula-based way (that I know of) to automatically hide unused rows, but it can be done with VBA.
    (VBA = Visual Basic for Applications - the programming language built-in to MS Office programs. Macros are procedures which are run using VBA.)

    Right-click on 'Main Table' and select 'View Code'. This will open up the VBE (Visual Basic Editor). You'll see a list of your sheets on the left-hand side, with 'Sheet3 (Main Table)' highlighted with a very pale blue background. On the right-hand side is a blank area where the programming is typed. Copy the code below and paste it there. The lines starting with an apostrophe are comments which actually don't do anything, but help explain what's going on - you can delete those if you want, but they don't slow things down, so I recommend leaving them there as reminders.
    Please Login or Register  to view this content.
    This code will run whenever this worksheet is re-calculated - which will happen whenever you change the selection in the drop-down box on the 'Select League' sheet. (By the way, 'tab' is just a commonly used word for 'worksheet' or 'sheet' - officially they're sheets, but everyone understands what's meant by 'tab'.)
    If you need to amend the sheet manually, enter 'X' (without the inverted commas) into cell A2 and the code won't run. Without this, every time you try to change it at all, the code will run, which can get annoying .

    A word of warning - for macros to run, the file has to be saved as a macro-enabled workbook (.xlsm). Because it's possible for malicious code to be run from them, macros are normally disabled, with a warning to users, who can then choose whether to allow macros to run or not. (See here: https://support.office.com/en-us/art...f-e8621e8fe373)
    If the macros are disabled, your formulae will all still work, but the 'unused rows' macro won't run.

    Bonus code :
    I don't know if you would find this useful, but if you want the file to always open on the 'Select League' sheet, then do this:
    In the VBE (which you can also open by pressing Alt-F11), right-click 'This Workbook' and select 'View Code'. Copy the code below and paste it in on the right-hand side:
    Please Login or Register  to view this content.
    Here's your file again, with the code added: 2015-16 _ ranking & hiding rows for essxmark _ AS.xlsm
    The bonus code to always open on the first sheet is there but not activated - if you want to use that, you can just remove the apostrophes from the beginning of each line in that code, so that it looks like the code above.

    I hope that does what you want.

  6. #6
    Registered User
    Join Date
    11-17-2015
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Ranking of Positions and Hiding of Unused Rows in Calculated League Table

    Hi there
    That is amazing - fantastic!
    Thank you so much for your help - Solved!! Reputation added!

  7. #7
    Forum Expert
    Join Date
    03-20-2015
    Location
    Primarily UK, sometimes NL
    MS-Off Ver
    Work: Office 365 / Home: Office 2010
    Posts
    2,405

    Re: Ranking of Positions and Hiding of Unused Rows in Calculated League Table

    You're welcome and thanks for the rep.

+ 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. Hiding unused rows.
    By sungen99 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-04-2015, 09:11 AM
  2. [SOLVED] League Table Ranking
    By Zipmeister in forum Excel General
    Replies: 2
    Last Post: 01-20-2014, 07:03 AM
  3. [SOLVED] Help ranking in league table
    By SChapman in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-24-2013, 03:29 AM
  4. League Table Ranking
    By okopo in forum Excel General
    Replies: 9
    Last Post: 01-10-2012, 08:51 AM
  5. Sports League Table defining positions 1st 2nd etc
    By runner20k in forum Excel General
    Replies: 3
    Last Post: 02-12-2009, 04:42 AM
  6. Hiding unused rows
    By Christoffer_Col in forum Excel General
    Replies: 2
    Last Post: 11-12-2008, 11:20 AM
  7. Hiding unused rows
    By Stayfair in forum Excel General
    Replies: 2
    Last Post: 04-24-2007, 07:10 PM

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