Search named ranges for matching cell contents

sedwardson

New Member
Joined
Mar 2, 2023
Messages
35
Office Version
  1. 365
Platform
  1. Windows
Hi all and thanks for all and any help. I have one workbook with two worksheets. I have a list of references on the first worksheet and a HUGE list of references on the second worksheet but they are grouped into two named ranges. I would like to write an equation where the reference in worksheet one, lets say 401YV480628 matches a reference on worksheet two in named range called "Yes" and then displays that named range i.e. "yes" next to it. If the match was found in the second named range ("No") I would like it to report that. So it would look something like this:

March 2023401YV480628Yes
February 2023410HF569447Yes
February 2023414GA580218No

I hope this makes sense. Thanks again for any help.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try this.

You may need to change the cell reference

=IF(NOT(ISERROR(MATCH(B2,Yes,0))),"Yes",IF(NOT(ISERROR(MATCH(B2,No,0))),"No",""))
 
Upvote 0
Try this.

You may need to change the cell reference

=IF(NOT(ISERROR(MATCH(B2,Yes,0))),"Yes",IF(NOT(ISERROR(MATCH(B2,No,0))),"No",""))
Hi Herakles, thanks for the prompt reply. That reports "Yes" or "No" and not the name of the range that the reference is located in as far as I can see. That being said, I'm still very new to VBA :-) so I'm happy to be corrected :-)
 
Upvote 0
You question seems to state that the named ranges are called 'Yes' and 'No'.

What are they called?
 
Upvote 0
You question seems to state that the named ranges are called 'Yes' and 'No'.

What are they called?
They are actually called "Family_Numbers" and Sandras_Numbers", but thought it might be easier with yes and no .......Apparently I was wrong ! :-)
 
Upvote 0
Try this. We only know what you tell us.
I've not tested this.

=IF(NOT(ISERROR(MATCH(B2,Family_Numbers,0))),"Yes",IF(NOT(ISERROR(MATCH(B2,Sandras_Numbers,0))),"No",""))
 
Upvote 0
Apologies for the miscommunication. I have tried the IF statement and it doesn't return anything.....
 
Upvote 0
It will return a zero length string if the reference is not found in either of the named ranges.
It will also return a zero length string if the named ranges cannot be found.

Are your named ranges called "Family_Numbers" and "Sandras_Numbers"?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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