If the value is not found in specific range, then try to find it in another range

zinah

Active Member
Joined
Nov 28, 2018
Messages
368
Office Version
  1. 365
Platform
  1. Windows
Hi,

I need a formula that can meet below statement:
If the value is not found in specific range, then try to find it in another range, if not found in both ranges, then NA.
Below is a sample data for more illustration:
If the ID is found in Range 1, then Range 1, if not found, then try to find in Range 2, if it's found, then Range 2, if not found in both ranges, then NA

Test File_LookupValue.xlsx
ABCDEFGHIJ
1IDExpected ResultsRANGE 1RANGE 2
2034RANGE 1IDID
3035RANGE 1
4036RANGE 1003040
5037RANGE 1005041
6030RANGE 1006042
7031RANGE 1007043
8037RANGE 1008044
9071RANGE 2009045
10072RANGE 2010046
11073RANGE 2011047
12074RANGE 2012048
13035RANGE 1030049
14036RANGE 1031068
15068RANGE 2034069
16076RANGE 1035070
17077RANGE 1036071
18071RANGE 2037072
19097NA076073
20098NA077074
Sheet1


thank you!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
How about
Excel Formula:
=IF(ISNUMBER(XMATCH(A2,$H$4:$H$20,0)),$H$1,IF(ISNUMBER(MATCH(A2,$J$4:$J$20,0)),$J$1,"NA"))
 
Upvote 0
Solution
How about
Excel Formula:
=IF(ISNUMBER(XMATCH(A2,$H$4:$H$20,0)),$H$1,IF(ISNUMBER(MATCH(A2,$J$4:$J$20,0)),$J$1,"NA"))
Thank you so much, that worked perfectly great, really appreciate your usual innovative solutions!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,642
Members
452,663
Latest member
MEMEH

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