+ Reply to Thread
Results 1 to 5 of 5

VBA to find last row of a unique value and insert formulas

  1. #1
    Registered User
    Join Date
    05-21-2021
    Location
    Honolulu, HI
    MS-Off Ver
    2016
    Posts
    9

    VBA to find last row of a unique value and insert formulas

    Hi Everyone,

    I'm working with a worksheet which has 10 columns - A thru J...several thousand rows of data. Column A contains the unique identifier (ID#). Data is sorted by column A.

    Instead of manually finding the last row for each unique ID, is there a way to automate the process of finding the last row for each unique value in column A, and then inserting a row with formula in columns E thru I to sum the values above for each unique ID?

    Thank you!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,596

    Re: VBA to find last row of a unique value and insert formulas

    You don't need VBA. This article explains how: Insert subtotals in a list of data in a worksheet

    See: https://support.microsoft.com/en-us/...e-b0a3d4a52b3a
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    05-21-2021
    Location
    Honolulu, HI
    MS-Off Ver
    2016
    Posts
    9

    Re: VBA to find last row of a unique value and insert formulas

    Thank you, that definitely worked but I failed to mention in my original post that column J would need a different formula to divide column I's result by column E.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,596

    Re: VBA to find last row of a unique value and insert formulas

    If you want code, you need to post data.


    Fast answers need visual help. Please read the yellow banner at the top of this page on how to attach a file and a mocked up solution.

  5. #5
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: VBA to find last row of a unique value and insert formulas

    Hi
    Assumed your data's start A1 & row1 is headers
    Try
    Please Login or Register  to view this content.
    Last edited by mohadin; 05-10-2023 at 08:10 AM.

+ 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. Replies: 2
    Last Post: 08-20-2021, 01:06 PM
  2. [SOLVED] Find unique values in a row and insert a row after every unique value in a column
    By arjunjshetty in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-16-2020, 11:24 AM
  3. Find Unique Rows & Insert a blank row & titles
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-29-2016, 05:40 PM
  4. Find 1st unique Value on Column and Insert certain Word on cell on left Column
    By Wldlife23 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2013, 10:02 AM
  5. [SOLVED] Find unique entries and create ranked list with formulas only
    By opheim in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-08-2013, 04:09 AM
  6. [SOLVED] convert formulas to vba - countif and find unique values
    By emm8080 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-16-2012, 11:49 AM
  7. URGENT! Search columns to find unique variables and then insert them in another sheet
    By fodaftrykket in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2011, 07:54 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