Need a formula to find a value in a range of both rows and columns

PFCSC

New Member
Joined
Dec 21, 2015
Messages
21
Hi there,

I am hoping someone could help me come up a formula that would allow me to find a cell in a range of both columns and rows.

I am trying to find an address say "123 New York, NY" and then return who lives at that address. The trouble is "123 New York, NY" could be anywhere in the range B2:CC8 and once the formula finds it, I want to return who lives at that address which is available in column A.

I'm not sure how this will look, but here's an image of what I'm trying to do:
ABCDEFG...CC
1NameAddress1Address2Address3Address4Address5Address6...Address77
2Peter111 Dallas, TX 321 Los Angeles, CA 123 Chicago, IL555 Houston, TX 111 San Francisco, CA 22 San Diego, CA
3Sam99 Omaha, NE 123 New York, NY
4Greg 123 Miami, FL
5Sarah345 Anchorage, AK555 Boston, MA 999 Baltimore, MD
6George666 Washington, D.C.
7Michael
8Anna

<tbody>
</tbody>


I would like a formula that could search B2:CC8 and find "123 New York, NY" and then return Sam.

Any help?

Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Maybe start with something like this.

Howard

Code:
Option Explicit
Sub Test_Address()
     
    Dim rFind As Range
    Dim myAddress as String, aCol As String
    
   myAddress = InputBox("Enter ADDRESS to search for")
     
    With Cells
        Set rFind = .Find(What:=myAddress, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
        If Not rFind Is Nothing Then
            
            aCol = rFind.Offset(, -(rFind.Column - 1))
           
            MsgBox aCol

        End If
    End With
     
End Sub

Hmm, I overlooked the request for formula. Sorry.
 
Last edited:
Upvote 0
Thank you for the reply!

Since I am going to be using this for hundreds of addresses (not just "123 New York, NY"), it would be ideal to not have to manually enter the store address into an InputBox each time, I'll need something that can work in bulk.

I have another tab with every address in column A and in Column B I want to know who is at that address by looking it up in the table previosuly described.

Thanks!
 
Upvote 0
Still not a formula, but this does about 5000 rows in around seven seconds on my computer. There may be an Index/Match formula that can do this, but I am at a loss to develop one.

Names and address' on sheet 3 and the list of address' in column A on sheet 4, names are posted in column B of sheet 4..

Copy code to a standard module and run from sheet 4.


Howard


Code:
Option Explicit

Sub Test_Address_Code()
     
    Dim rFind As Range
    Dim Nme As String
    Dim OneRng As Range
    Dim c As Range

' List of names in sheet4 change sheet name to match
Set OneRng = Sheets("Sheet4").Range("A2:A" & Cells(Rows.Count, "A").End(xlUp).Row)

For Each c In OneRng

     'all the address' & names are in sheet3 change sheet name to match
    With Sheets("Sheet3").Cells

        Set rFind = .Find(What:=c, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)

        If Not rFind Is Nothing Then
            
           c.Offset(, 1) = rFind.Offset(, -(rFind.Column - 1))
          
        End If

    End With

Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,959
Messages
6,122,476
Members
449,087
Latest member
RExcelSearch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top