Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Searching for a cell with specified values

So I have a tab that contains the following data:
Project Order1 Order2 Order3 etc
ABC 123 456 789
DEF 654 951 159

Basically, I want to do a search (similar to ctrl - H) on the tab and look
for Order 159. The main information I want is the Project name. I've got
thousands of line, and hundred of Orders to look up; orders go all the way
to
column IV on a few of them. So I need either a formula (similar to vlookup
or search) or a macro that can look up a cell, search the other tab, and
return either a cell location or, better yet, the project.

Is this possible? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Searching for a cell with specified values

Suppose we have:

1 3 5 5
12 44 7 4
43 33 22 87
56 55 17 6
76 66 121 9
37 77 99 8
1 88 4 5

in A1 thru D7 and 17 in A15

The UDF:

Function where_is_it(r1 As Range, r2 As Range) As String
Dim m As Double
m = r1.Value
where_is_it = r2.Find(What:=m, after:=r2(r2.Count)).Address
End Function


when used like:
=where_is_it(A15,A1:D7)
will return
$C$4
the location of 17
--
Gary''s Student
gsnu200710


"FredL" wrote:

So I have a tab that contains the following data:
Project Order1 Order2 Order3 etc
ABC 123 456 789
DEF 654 951 159

Basically, I want to do a search (similar to ctrl - H) on the tab and look
for Order 159. The main information I want is the Project name. I've got
thousands of line, and hundred of Orders to look up; orders go all the way
to
column IV on a few of them. So I need either a formula (similar to vlookup
or search) or a macro that can look up a cell, search the other tab, and
return either a cell location or, better yet, the project.

Is this possible? Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Searching for a cell with specified values

Thanks.

Can this code work as is and does this code work if the order is in text
format?
I put this code in VBA and tried using it, but I get the #NAME? error. It
doesn't seem to recognize the function. The only change I made was using
Locate instead of where_is_it. I've done some simple function code, so maybe
I was being too simplistic and hoping that the code would work as is.

Fred

"Gary''s Student" wrote:

Suppose we have:

1 3 5 5
12 44 7 4
43 33 22 87
56 55 17 6
76 66 121 9
37 77 99 8
1 88 4 5

in A1 thru D7 and 17 in A15

The UDF:

Function where_is_it(r1 As Range, r2 As Range) As String
Dim m As Double
m = r1.Value
where_is_it = r2.Find(What:=m, after:=r2(r2.Count)).Address
End Function


when used like:
=where_is_it(A15,A1:D7)
will return
$C$4
the location of 17
--
Gary''s Student
gsnu200710


"FredL" wrote:

So I have a tab that contains the following data:
Project Order1 Order2 Order3 etc
ABC 123 456 789
DEF 654 951 159

Basically, I want to do a search (similar to ctrl - H) on the tab and look
for Order 159. The main information I want is the Project name. I've got
thousands of line, and hundred of Orders to look up; orders go all the way
to
column IV on a few of them. So I need either a formula (similar to vlookup
or search) or a macro that can look up a cell, search the other tab, and
return either a cell location or, better yet, the project.

Is this possible? Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Searching for a cell with specified values

That particular error means that Excel cant find the function. It must go
in a standard module:


Functions are very easy to install and use:

1. CNTRL-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the function will be saved with it.


To remove the function:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about functions in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

If you have any other problems, just update this post and we will work them
out.


--
Gary''s Student
gsnu200710


"FredL" wrote:

Thanks.

Can this code work as is and does this code work if the order is in text
format?
I put this code in VBA and tried using it, but I get the #NAME? error. It
doesn't seem to recognize the function. The only change I made was using
Locate instead of where_is_it. I've done some simple function code, so maybe
I was being too simplistic and hoping that the code would work as is.

Fred

"Gary''s Student" wrote:

Suppose we have:

1 3 5 5
12 44 7 4
43 33 22 87
56 55 17 6
76 66 121 9
37 77 99 8
1 88 4 5

in A1 thru D7 and 17 in A15

The UDF:

Function where_is_it(r1 As Range, r2 As Range) As String
Dim m As Double
m = r1.Value
where_is_it = r2.Find(What:=m, after:=r2(r2.Count)).Address
End Function


when used like:
=where_is_it(A15,A1:D7)
will return
$C$4
the location of 17
--
Gary''s Student
gsnu200710


"FredL" wrote:

So I have a tab that contains the following data:
Project Order1 Order2 Order3 etc
ABC 123 456 789
DEF 654 951 159

Basically, I want to do a search (similar to ctrl - H) on the tab and look
for Order 159. The main information I want is the Project name. I've got
thousands of line, and hundred of Orders to look up; orders go all the way
to
column IV on a few of them. So I need either a formula (similar to vlookup
or search) or a macro that can look up a cell, search the other tab, and
return either a cell location or, better yet, the project.

Is this possible? Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Searching for a cell with specified values

Great, I finally got it to work. Not sure why, but I did exactly what I did
yesterday, and now it works. Thanks a million.

btw, in my system (PC) I used alt+f11 to get to the VBE Window, Alt+T,M,V to
achieve the same as above. When I did the ctrl+f11, a tab named Macro
appeared

"Gary''s Student" wrote:

That particular error means that Excel cant find the function. It must go
in a standard module:


Functions are very easy to install and use:

1. CNTRL-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the function will be saved with it.


To remove the function:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To learn more about functions in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

If you have any other problems, just update this post and we will work them
out.


--
Gary''s Student
gsnu200710


"FredL" wrote:

Thanks.

Can this code work as is and does this code work if the order is in text
format?
I put this code in VBA and tried using it, but I get the #NAME? error. It
doesn't seem to recognize the function. The only change I made was using
Locate instead of where_is_it. I've done some simple function code, so maybe
I was being too simplistic and hoping that the code would work as is.

Fred

"Gary''s Student" wrote:

Suppose we have:

1 3 5 5
12 44 7 4
43 33 22 87
56 55 17 6
76 66 121 9
37 77 99 8
1 88 4 5

in A1 thru D7 and 17 in A15

The UDF:

Function where_is_it(r1 As Range, r2 As Range) As String
Dim m As Double
m = r1.Value
where_is_it = r2.Find(What:=m, after:=r2(r2.Count)).Address
End Function


when used like:
=where_is_it(A15,A1:D7)
will return
$C$4
the location of 17
--
Gary''s Student
gsnu200710


"FredL" wrote:

So I have a tab that contains the following data:
Project Order1 Order2 Order3 etc
ABC 123 456 789
DEF 654 951 159

Basically, I want to do a search (similar to ctrl - H) on the tab and look
for Order 159. The main information I want is the Project name. I've got
thousands of line, and hundred of Orders to look up; orders go all the way
to
column IV on a few of them. So I need either a formula (similar to vlookup
or search) or a macro that can look up a cell, search the other tab, and
return either a cell location or, better yet, the project.

Is this possible? Thanks.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 340
Default Searching for a cell with specified values

If data is in A1:D10 and lookup value is in K1 say, try:

=INDEX(A$1:A$10,MIN(IF(A$1:H$10=K1,ROW(A$1:H$10))) )

executed with ctrl+shift+enter as it's an array formula.


On 15 Mar, 23:08, FredL wrote:
So I have a tab that contains the following data:
Project Order1 Order2 Order3 etc
ABC 123 456 789
DEF 654 951 159

Basically, I want to do a search (similar to ctrl - H) on the tab and look
for Order 159. The main information I want is the Project name. I've got
thousands of line, and hundred of Orders to look up; orders go all the way
to
column IV on a few of them. So I need either a formula (similar to vlookup
or search) or a macro that can look up a cell, search the other tab, and
return either a cell location or, better yet, the project.

Is this possible? Thanks.



  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Searching for a cell with specified values

Hi Lori,

I tried this as well, but got the #Value! error. I'm wondering if the IF
statement is causing it or not.

Fred

"Lori" wrote:

If data is in A1:D10 and lookup value is in K1 say, try:

=INDEX(A$1:A$10,MIN(IF(A$1:H$10=K1,ROW(A$1:H$10))) )

executed with ctrl+shift+enter as it's an array formula.


On 15 Mar, 23:08, FredL wrote:
So I have a tab that contains the following data:
Project Order1 Order2 Order3 etc
ABC 123 456 789
DEF 654 951 159

Basically, I want to do a search (similar to ctrl - H) on the tab and look
for Order 159. The main information I want is the Project name. I've got
thousands of line, and hundred of Orders to look up; orders go all the way
to
column IV on a few of them. So I need either a formula (similar to vlookup
or search) or a macro that can look up a cell, search the other tab, and
return either a cell location or, better yet, the project.

Is this possible? Thanks.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching for cell values alistre Excel Discussion (Misc queries) 2 August 24th 06 03:45 AM
searching text values in two columns destrolennox Excel Discussion (Misc queries) 1 August 12th 06 03:53 AM
searching and collating values in multiple sheets dave99 Excel Discussion (Misc queries) 1 January 7th 06 10:55 PM
searching for values and summing the corresponding values Simon Excel Worksheet Functions 1 February 4th 05 12:13 AM
Formula for Searching & matching two values in excel Chris Excel Discussion (Misc queries) 1 January 7th 05 04:34 PM


All times are GMT +1. The time now is 03:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"