+ Reply to Thread
Results 1 to 12 of 12

Needing an auto-sort macro from MIN calculation

  1. #1
    Registered User
    Join Date
    04-21-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    6

    Needing an auto-sort macro from MIN calculation

    So I'm sorry if this has already been covered, but I didn't know how to search for what I want to do. I work at a race track and we do not have transponders yet. What I want to do is place a lap time into 2 columns (representing each lap), then excel chooses the lowest number in the two columns on the same row, paste it into another column, and then automatically sort, while keeping the first column static for 1, 2, 3, 4, 5 etc

    So what I want is
    Column A | Column B | Column C | Column D | Column E
    1 | Driver Name | 14.004 | 14.102 | 14.004

    I want Column A to remain in tact, never changing, 1-50. I want Column E to hold the fastest lap time calculated from C and D. Then I want excel to automatically sort Column E from lowest to highest, while keeping Column B with a specific driver name in line with their respective lap times. Column A is not a 100% solid requirement, but auto sorting Column E after it's calculated the minimum value of C and D is.

    Thanks in advance for your time and help, this would be a lifesaver!

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Needing an auto-sort macro from MIN calculation

    Is this what you had in mind?
    Try on a copy of your workbook.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-21-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Needing an auto-sort macro from MIN calculation

    Quote Originally Posted by jolivanes View Post
    Is this what you had in mind?
    Try on a copy of your workbook.
    Please Login or Register  to view this content.
    Thank you very much! That works wonderfully, however I do have one more question. Is there a way to make it automatically sort Column E once a cell changes in Column E without having to hit any buttons? The reason I ask is because I am a PA announcer and I'll already be working with 2 spreadsheets (one with driver info, sorted, and this one for lap times) and I don't want to have to hit a button to sort. I don't mind clicking on an empty cell should lap 1 be the quickest, but it's fiddling with keys that makes it difficult.

    Thanks again and thanks for your time!

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Needing an auto-sort macro from MIN calculation

    How are the times entered in columns C and D? Manually?
    I assume column C first and after that column D. Is that right?

  5. #5
    Registered User
    Join Date
    04-21-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Needing an auto-sort macro from MIN calculation

    Quote Originally Posted by jolivanes View Post
    How are the times entered in columns C and D? Manually?
    I assume column C first and after that column D. Is that right?
    Yes that is correct, I enter them manually (14.000), and C is for Lap 1, D for lap 2, E for best lap

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Needing an auto-sort macro from MIN calculation

    Copy this code in the vba window of the sheet where your information is, not in the Module vba window.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-21-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Needing an auto-sort macro from MIN calculation

    Quote Originally Posted by jolivanes View Post
    Copy this code in the vba window of the sheet where your information is, not in the Module vba window.

    Please Login or Register  to view this content.
    Thank you so much jolivanes for working on this for me! We're almost there to where I need it. I right-clicked on my sheet tab, clicked View Code, and pasted the code there. Whatever data I put into Column D is sorted, but not the data from Column C. Furthermore the data in Column B doesn't work it's way up in the order, it just stays the same.

    Basically, I'll be listing drivers by how they drew (1-50) and when they're qualifying, I need to put in Lap 1 time, and it be sorted then. I'll then move to where it moved to and put the Lap 2 time in, and it sorts it again (if it's lower). So if I have John Doe draw a 13, he'll be 13th on my sheet until I put in the new lap time (For the sake of rank, I've got it started with 99.999). If John Doe runs a lap time 2nd quick on Lap 1, I need it to move John Doe to the 2nd row, and if Lap 2 is slower, nothing is done, but if Lap 2 is faster, then record it, then re-sort from there.

    If that's outside the capabilities of Excel, I could just use a code for a single lap time, and I can keep the lap time or delete the lap time and enter the new faster time before hitting enter and moving onto the next qualifier, but I'd need it to move the Column B data up in the rank along with the lap time entered into that row.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Needing an auto-sort macro from MIN calculation

    Play around with the attached.
    Let us know the changes you want made.

    Have fun and good luck.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    04-21-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Needing an auto-sort macro from MIN calculation

    Quote Originally Posted by jolivanes View Post
    Play around with the attached.
    Let us know the changes you want made.

    Have fun and good luck.
    Awesome work!!!

    This almost does what I need it to do. I do have a couple final requests on this. How would I go about adding a header row up top and it stay on top, and is it possible to make Column A stay 1, 2, 3, 4, 5, 6 etc for each row? I want the next row under the header to be for my fastest qualifier, and in the Column A (Position), I'd like it to retain 1 through 50 all the way down, but still sort the names and that other stuff.

    And also, when I add more drivers names beyond the ones you started me out with, it does not record the fastest lap in Column E and therefore does not sort. I have no idea what I'm doing with excel outside of the simple formulas that I've googled and entering data, hahaha!

    Other than that couple final requests, this works EXACTLY how I need it to work. Thank you so much for your help on this!

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Needing an auto-sort macro from MIN calculation

    Would this be it?
    Again, let us know.
    Good luck and have fun.
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    04-21-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Needing an auto-sort macro from MIN calculation

    Biiiiiiiiiingooooooo! Thank you, that does it all, that's perfect! You rock! Do you have a way for me to donate some money for your time, like PayPal? I won't have any extra money for a couple weeks but I want to give you a small token of my appreciation for your dedication to this project!

  12. #12
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,528

    Re: Needing an auto-sort macro from MIN calculation

    Appreciation does it.
    Go and have beer in your spare time for it.
    Appreciate your response.

    Good luck with the races.
    Regards
    John

+ 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. Auto Sort macro
    By YaSSaL in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2013, 06:23 AM
  2. [SOLVED] Auto Sort Macro
    By lj8675309 in forum Excel General
    Replies: 5
    Last Post: 11-15-2012, 04:09 PM
  3. [SOLVED] Auto sort with macro
    By magman1984 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2012, 03:30 PM
  4. Man Day Calculation and Auto Sort
    By BAAllen in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-03-2011, 09:04 AM
  5. Auto Sort using Macro
    By Rubix in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-13-2005, 05:30 AM

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