Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 422467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:05:03+00:00 2026-05-12T19:05:03+00:00

I would like to build an excel VBA program to find all the match

  • 0

I would like to build an excel VBA program to find all the match values from a table and print the finding on a column… I tried to use vlookup but only gives me the first location that finds… and I would like all the finds.

here is an example:
my table starts on cell A2

  • column A (number)
  • 0084
  • 0084
  • 0085
  • 0085
  • 0086
  • 0087

  • column B (location)

  • 12AC5
  • 16AC5
  • 02AC5
  • 06AC5
  • 01DC5
  • 11DC5

on column D I paste the values I am looking for there location….. on column F would give me all the location found that matches my request… in ascending order or any order

for example I am looking for the location of 2 numbers:

  • column D (I paste the number that I what to see there location
  • 0084
  • 0087

I expect to see the results:

  • column F(found location)
  • 12ac5
  • 12bd5
  • 16ac5

Any help with this would be very much appreciated..

Cheers,
JFFC
excel VBA

enter code here
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:05:04+00:00Added an answer on May 12, 2026 at 7:05 pm

    Clarification required. Are you:

    Wanting to search for multiple values (in column A), return all the corresponding values(in column B) into column F?

    An example of this is:

    A, B, D, F
    1,loc1,1,loc1
    1,loc2,2,loc2
    2,loc3, ,loc3
    3,loc4, ,
    3,loc5, ,
    4,loc6, ,

    Showing that if you serach for 1 and 2 (in column D) you get back Loc1, loc2 and loc3 because these are all the locations that match the numbers 1 and 2?

    If this isnt what u are trying to do then i am confused

    Macro to achieve this:

    Sub FindLocations()
    
    Dim ValueCell As Range
    Dim SearchCell As Range
    Dim ResultCounter As Integer
    Dim ValueCol, LocCol, SearchCol, ResultCol As Integer
    
    ValueCol = 1 'Look for the values in this column'
    LocCol = 2 'Locations are in this column'
    SearchCol = 4 'The search values are in this column'
    ResultCol = 6 'Spit out the results in this column'
    
    ResultCounter = 2
    
    For Each ValueCell In Range(Cells(2, ValueCol), Cells(ActiveSheet.UsedRange.Rows.Count, ValueCol))
    
        For Each SearchCell In Range(Cells(2, SearchCol), Cells(ActiveSheet.UsedRange.Rows.Count, SearchCol))
            If SearchCell.Value = ValueCell.Value Then
                Cells(ResultCounter, ResultCol).Value = Cells(ValueCell.Row, LocCol).Value
                ResultCounter = ResultCounter + 1
                Exit For
            End If
        Next
    Next
    End Sub
    

    Paste that into your Excel VBA screen (Alt+F11) and run it (or link it to a button) Whenever you want to search click it

    The results of this look like this:
    Excel Example http://img97.imageshack.us/img97/9310/excelexample.jpg

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry for my Noobness with Excel/Vba... coming from a unix world...I need help! I
I think every business person would like to have excel UI, however they are
I would like to do some basic charting in F# using build in features
I am doing a little Excel + vba application and I have got stuck.
the Requirement in simple words goes like this. Its a charting Application ( kinda
One thing I want to do is build a personal database for myself at
We Want to Run Our C# Code on the JVM My company has a
The requirements for this web app include the following: 1- Need to interact with
In a web application I am working on, the user can click on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.