Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Clarification required. Are you:</p> <p>Wanting to search for multiple values (in column A), return all the corresponding values(in column B) into column F?</p> <p>An example of this is:</p> <p>A, B, D, F<br> 1,loc1,1,loc1<br> 1,loc2,2,loc2<br> 2,loc3, ,loc3<br> 3,loc4, , <br> 3,loc5, , <br> 4,loc6, , <br></p> <p>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?</p> <p>If this isnt what u are trying to do then i am confused</p> <p>Macro to achieve this:</p> <pre><code>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 </code></pre> <p>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</p> <p>The results of this look like this: <a href="http://img97.imageshack.us/img97/9310/excelexample.jpg" rel="nofollow noreferrer">Excel Example http://img97.imageshack.us/img97/9310/excelexample.jpg</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload