+ Reply to Thread
Results 1 to 8 of 8

Request for VBA code to select top 3 or 5 ,userwise audit samples

  1. #1
    Registered User
    Join Date
    03-22-2021
    Location
    india
    MS-Off Ver
    2016
    Posts
    4

    Request for VBA code to select top 3 or 5 ,userwise audit samples

    hi ,

    I am new to VBA, i am looking for VBA code, to one of my workings,

    i have a data in sheet1 wtih multiple rows and coloums, form which i need pick audit samples Top3 or Top5 based on Analyst names and Transaction Amount.

    A1 [Analyst Name] B2 [Transaction Amount]

    Mr X 100$
    Mr Y 500$
    Mr Z 200$
    Mr A 1000$
    Mr X 500$
    Mr Y 1000$
    Mr Z 100%

    my data in sheet1 and output of samples to be in sheet2 ( attached sample excel work sheet with for referance)

    please help with query ..

    Thank you in advance
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Request for VBA code to select top 3 or 5 ,userwise audit samples

    You may want to look into the RANK formula along with the SUMPRODUCT formula

    You can place this in your D5 cell:

    Please Login or Register  to view this content.
    Apply down and that will rank the list, you can then pull out the top x
    If you find the suggestion or solution helpful, please consider adding reputation to the post.

  3. #3
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Request for VBA code to select top 3 or 5 ,userwise audit samples

    Forget the above, here is your file with a mix of formulas to give you the results.

    I updated with the dollars so you can see why those were chosen as the top ones.
    Attached Files Attached Files
    Last edited by cubangt; 07-09-2021 at 03:13 PM.

  4. #4
    Registered User
    Join Date
    03-22-2021
    Location
    india
    MS-Off Ver
    2016
    Posts
    4

    Re: Request for VBA code to select top 3 or 5 ,userwise audit samples

    .........................
    Last edited by msn18; 07-10-2021 at 11:45 AM.

  5. #5
    Registered User
    Join Date
    03-22-2021
    Location
    india
    MS-Off Ver
    2016
    Posts
    4

    Re: Request for VBA code to select top 3 or 5 ,userwise audit samples

    hi Sir,

    I have tryed with above forumal, but it showing only the top3 samples of only 1Analyst, i need to select samples of each analyst with top3 of high value.

    i have multiples rows and coulums in my workseet, so could you please help with VBA query if i input my data in sheet1 and my output should be with top3 / top5 of each Analyst .

    thank you in advance

  6. #6
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Request for VBA code to select top 3 or 5 ,userwise audit samples

    Hi msn18,

    Try below code based on your sample file ...
    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  7. #7
    Valued Forum Contributor
    Join Date
    05-15-2017
    Location
    US
    MS-Off Ver
    365
    Posts
    901

    Re: Request for VBA code to select top 3 or 5 ,userwise audit samples

    Quote Originally Posted by msn18 View Post
    hi Sir,

    I have tryed with above forumal, but it showing only the top3 samples of only 1Analyst, i need to select samples of each analyst with top3 of high value.

    i have multiples rows and coulums in my workseet, so could you please help with VBA query if i input my data in sheet1 and my output should be with top3 / top5 of each Analyst .

    thank you in advance
    You are correct, it shows the same analyst, because its that one that has the 3 highest dollar amounts. If you look at the top5 column it pulls in 2 others as well.. The formula i used is basing its ranking on the dollar amount.
    If you are wanting to have it select the top 3 based on the pair of information, it will need some adjustments.

    Take a look at nankw83 code and see if that helps..

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: Request for VBA code to select top 3 or 5 ,userwise audit samples

    Thank you msn18 for the added Rep. points. If the provided solution takes care of your question, please take a moment & mark the thread as [SOLVED] from the Thread Tools above your first post

+ 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. Samples generated via VBA code are repetitive
    By BontleD in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-05-2020, 03:54 AM
  2. audit log VBA code not capturing IF formula result
    By Alister Davis in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-13-2018, 09:11 AM
  3. VBA code for audit trail issue
    By TheGrinch1 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-11-2015, 08:06 AM
  4. Assistance with Audit code...
    By ciresuark in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-26-2015, 01:26 PM
  5. stock audit & bar code scanner
    By joemahony in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-28-2008, 12:53 AM
  6. Select Certain Samples
    By blueperfume300 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-19-2007, 08:57 PM
  7. Excel Code Samples
    By HSalim[MVP] in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-26-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