Search : in
By :

Excel search macro

Last answer on Jan 5, 2009 7:14:48 am GMT Game, on Dec 30, 2008 5:06:09 am GMT 
 Report this message to moderators

Hello,

I have a very tricky problem. I have got an excel sheet having some columns but more than 5000 rows. In those columns there are some names which may/may not be similar to each other. I want to make a macro which can:

1. Search for the name. e.g. If I have Katie Holmes in 1st row, Sherlock Holmes in 2nd row, Holmes Matt in 3rd row, James Holmes Dammon in 4th row and so on....then if put only Holmes in search criteria then it should get the result for all the 4 rows.

2. Secondly it should display only those 4 rows in the result. Like if we are using a sort function.

3. Thirdly I also want to have a macro so that I can reset that search criteria.

This macro is very important for me. Please reply ASAP. Thanks in advance.

PS: The search should be column specified meaning that I want the macro to search only column A and no other columns.

Best answers for « Excel search macro » in :
Excel – Macro to detect and hide blank rows Show Excel – Macro to detect and hide blank rows Issue Solution Note Issue I want a macro to unhide about 20 blank rows copy values into the top row then hide the remaining rows (some cells have fill though) then the next time it will...
Excel – Macro for copy & paste selected range ShowExcel – Macro for copy & paste selected range Issue Solution Note Issue I have a summary of data by month in one sheet and the raw data in another sheet. Instead of creating multiple worksheets for my raw data for each month, I want...
How to convert Excel into PDF? ShowHow to convert Excel into PDF? Here is a small tips about how to convert your excel files into PDF for your presentation. Step 1 PDF995 is software that gets installed on your computer which enables you to print any sources of document to...
Excel tips : How to insert date in a cell ShowExcel tips : How to insert date in a cell Below are some tips on how to insert date and time in an excel cell for a specific purpose:- To insert current date, press CTRL + ; in the chosen cell. To insert current time, press CTRL+...
Download Super Macro ShowSuper macro is a free software which allows to create macro under Windows in order to activate diverse automatic actions. Apart being free, this software is easy to use and requires no knowledge in programming. You just simply click buttons, then...

1

buster23, on Dec 30, 2008 8:02:18 am GMT

Hi,
you can learn how to do your tricks using the link:
http://office.microsoft.com/en-us/excel/HA011189581033.aspx

Reply to buster23

2

WD, on Dec 31, 2008 2:07:53 am GMT

Here's my take on this.

Don't use a Macro.

Place your list of names (or whatever) in Column D of Sheet2.

Use a dummy/sort column with a =if(iserror(Find(Sheet1!A$1,D2)),0,1) statement (column A) and another column (B) with =B1+A2 and then use column C for =A2*B2.

Set Cell A1 on Sheet1 up as your search criteria and then set Cells A2..A100 as 1, 2, 3, 4, ... for as many matches as you think you may have up to the number of possibilities.

For range B2..B100, set the cell formula as =if(iserror(vlookup(A2,Sheet2!$c$2:$D$100,2,false)),"",vlookup(A2,Sheet2!$c$2:$D$100,2,false)
)

The formula in Column B will find the unique identifiers (1, 2, 3, etc...) in Column C of Sheet2 and return the value in Column D. The numbers will be in sequential rows for as many as you have valid logical answers. The Find function will locate the string value indicated in cell A1 of Sheet1 anywhere it occurs in the list of string values and will generate either a 1 or 0 based on the presence of the test string. The B1+C2 formula will index the valid entries by +1 every time it recognizes them in the list and the multiplying the 2 column together you will wind up with the unique identifier set 0, 0, 0, 1, 0, 0 , 2, 0, 3, 0, ... This will probably update faster than a Macro that can do the same job.

Reply to WD

3

 Game, on Jan 5, 2009 7:14:48 am GMT
  • +2

Thanks for your answers.

Reply to Game