+ Reply to Thread
Results 1 to 7 of 7

Find previous same number

  1. #1
    Forum Contributor
    Join Date
    12-12-2017
    Location
    New Zealand
    MS-Off Ver
    MS 365
    Posts
    508

    Smile Find previous same number

    Hello all ,

    This is my first post here and im not joking about my user name .

    I am trying to get the results I have in cols BJ and BK , a macro is what im after
    as I have 440,000 rows to go thru .

    Here are three horses . Example I give is looking back .
    I need to look at the number in cell BI26 and find the same number before this row in same col for this horse only .
    This is found in BI22 .
    Now look to cells AL22 and AO22 and copy this data to cells BJ26 and BK26 .

    Now repeat process , look at number in cell BI25 , find same number of same horse previously in same col .
    Im only wanting results for each horse seperately .

    If there is no previous number then leave blank .

    Im told this cant be done .

    Thanks .
    Attached Files Attached Files

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Find previous same number

    Try this

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-12-2017
    Location
    New Zealand
    MS-Off Ver
    MS 365
    Posts
    508

    Re: Find previous same number

    Thanks mrice your macro is definitely what im needing with this . Nearly there .

    As per my second attachment i have marked in green cells that should be empty , same as my results in cols BL and BM .

    Your macro works great but its looking at another horses stats (in green) when it should of stopped .

    As we can see Farbaric never had a RO ran off or Sarbara Ann never F Fell .

    Thanks .
    Attached Files Attached Files

  4. #4
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Find previous same number

    OK, try

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    12-12-2017
    Location
    New Zealand
    MS-Off Ver
    MS 365
    Posts
    508

    Re: Find previous same number

    That second macro nailed it . Thanks .

    Probably pushing my luck here but is it possible to find the 2nd previous occurrence .
    Thanks again .

  6. #6
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: Find previous same number

    Sorry for the delayed reply - holiday season.

    The new version counts the matches and exits the loop after the second. The same structure can be adapted to find the third etc.

    Please Login or Register  to view this content.
    Happy new year.

  7. #7
    Forum Contributor
    Join Date
    12-12-2017
    Location
    New Zealand
    MS-Off Ver
    MS 365
    Posts
    508

    Re: Find previous same number

    All the best to you too .
    Thanks for the new version , i have managed to put the third in there as well . Gives me a lot to work with .
    Thanks again .

+ 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. Find previous number of certain unit and paste in current cell
    By firmfoundation in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-07-2015, 11:27 AM
  2. Need to figure out how to find a number from a previous sheet, from a range.
    By King Aurthor in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-27-2015, 02:15 AM
  3. [SOLVED] Find certain word, copy and paste cell in previous row if previous row is blank
    By steven_e in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-19-2013, 12:53 PM
  4. [SOLVED] Find last previous non blank value and summarise previous 6 months
    By Lady_Shaz in forum Excel General
    Replies: 7
    Last Post: 12-11-2012, 06:20 AM
  5. Replies: 0
    Last Post: 09-06-2012, 10:41 AM
  6. find the previous number divisble by 5 before a provided number...
    By all4excel in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-05-2008, 04:06 PM
  7. [SOLVED] change cell shading when a number differs from the previous number
    By zooeyhallne in forum Excel General
    Replies: 1
    Last Post: 06-06-2005, 06: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