+ Reply to Thread
Results 1 to 5 of 5

VBA Extract Highest and Second Highest Figures

  1. #1
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    VBA Extract Highest and Second Highest Figures

    Hi, I wonder whether someone may be able to help me please.

    For several days I've been attempting to put together a script which in simple terms finds the 'Highest and Second' highest activity and associated FTE for a given sub group.

    To be more specific:
    • On the "Slide 1" sheet look at the values in column J starting at row 7 until blank;
    • For each value, then search the "All Monthly Direct Activities" sheet in column C for the same value, excluding the 'Subtotal' rows;
    • Where a match is found, compare all the values in column E for that sub group;
    • And Find the highest and second highest figure;
    • Once these are found copy this figure and associated value in column B and paste onto the "slide 1" sheet.

    I must admit, I've failed quite miserable, and I just wonder whether someone may be able to look at this please and offer some guidance on how I may go about achieving this.

    I appreciate that my description may not be the most straight forward, so I have attached a sample workbook.

    This work book shows the 'Source' data on the "All Monthly Direct Activities" sheet and the 'Destination', "Slide 1" sheet. The cells in orange are the expected outcome from the 'Source' sheet.

    Many thanks and kind regards
    Attached Files Attached Files

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA Extract Highest and Second Highest Figures

    Maybe
    Please Login or Register  to view this content.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Extract Highest and Second Highest Figures

    Hi @Solus Rankin, thank you very much for taking the time to reply to my post and for the code, it's exactly what I was after.

    All the very best and kind regards

  4. #4
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Extract Highest and Second Highest Figures

    Hi @Solus Rankin, thank you very much for taking the time to reply to my post and for the code, it's exactly what I was after.

    All the very best and kind regards

  5. #5
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA Extract Highest and Second Highest Figures

    Glad to help!

  6. #6
    Forum Contributor
    Join Date
    05-26-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    682

    Re: VBA Extract Highest and Second Highest Figures

    Hi @Solus Rankin, I'm sorry to trouble you again, but I've taking a closer look at the code you kindly provided and unfortunately I'm coming up against is a slight problem.

    I've run the several times, and although the correct 'Highest' and 'Second Highest figures are correctly extracted, the associated Activity Description in column B of the 'Source' sheet is not.

    I just wondered whether you may be able to look at this please.

    Many thanks and kind regards

  7. #7
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: VBA Extract Highest and Second Highest Figures

    Hi..

    Solus Rankin..

    I attempted to modify your code... it seems to work...

    http://www.ozgrid.com/forum/showthre...d=1#post693011

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: VBA Extract Highest and Second Highest Figures

    apo,

    Thank you for posting a response on here.

+ 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. Sorting a column of figures into highest to lowest
    By josand in forum Excel General
    Replies: 4
    Last Post: 10-02-2012, 09:53 AM
  2. VBA code to find highest and 2nd highest number based in criteria
    By Michael007 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-25-2011, 08:38 AM
  3. Highest figures
    By spoter in forum Excel General
    Replies: 7
    Last Post: 07-07-2009, 08:05 AM
  4. Replies: 3
    Last Post: 08-10-2006, 11:40 PM
  5. Replies: 3
    Last Post: 10-03-2005, 09:05 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