Formula for two columns with multiple ranges

exceleratevba

New Member
Joined
Feb 27, 2017
Messages
11
I have a table with two columns that have rows with various ranges. What formula would I need to use to have my values in Column A to check if they are within the ranges in columns B and C.

I'm looking to have each cell with a value check if it falls between any of the ranges in the columns and return a Yes or No

The issue I'm running into is that values have 10 digits and the range values have 9 digits.

[TABLE="width: 437"]
<tbody>[TR]
[TD][TABLE="width: 437"]
<tbody>[TR]
[TD][TABLE="width: 437"]
<tbody>[TR]
[TD]HS Codes(VALUES)[/TD]
[TD]HS Range From[/TD]
[TD]HS Range To[/TD]
[TD]EC18 Statement[/TD]
[TD]Formula[/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]102310000[/TD]
[TD]102390000[/TD]
[TD] Yes or NO[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]105151000[/TD]
[TD]105159000[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]106110000[/TD]
[TD]106900090[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]207601100[/TD]
[TD]208900090[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]210910000[/TD]
[TD]210930000[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]210999000[/TD]
[TD]210999000[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]301110000[/TD]
[TD]301190000[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]301920000[/TD]
[TD]301920000[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]301990010[/TD]
[TD]301990090[/TD]
[TD] [/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col><col span="2"><col span="2"></colgroup>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col><col span="2"><col span="2"></colgroup>[/TABLE]
 
Hi,

Obviously, a 10 digit number will Never be within 2 Nine digit numbers, so I'm assuming you're comparing only Part of the number in Column A (HS Codes), so which part are we using or ignoring?
 
Last edited:
Upvote 0
I'm going through the columns and updating the digits to 10. What about now?


[TABLE="class: cms_table, width: 437"]
<tbody>[TR]
[TD] Codes(VALUES)[/TD]
[TD]HS Range From[/TD]
[TD]HS Range To[/TD]
[TD]EC18 Statement[/TD]
[TD]Formula[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 437"]
<tbody>[TR]
[TD]9403609090[/TD]
[TD]9307000000[/TD]
[TD]9307000000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9401691000[/TD]
[TD]9401699000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9401900030[/TD]
[TD]9401900030[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9403300010[/TD]
[TD]9403609090[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9504200000[/TD]
[TD]9504200000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9508100011[/TD]
[TD]9508100020[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9601100000[/TD]
[TD]9601900000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9614001100[/TD]
[TD]9614001100[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9615190000[/TD]
[TD]9615190000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9703000000[/TD]
[TD]9703000000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9705000000[/TD]
[TD]9706000090[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]9403609090[/TD]
[TD]9897000000[/TD]
[TD]9897000000[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col><col span="2"><col span="2"></colgroup>[/TABLE]
 
Upvote 0
Hi,

In your latest sample, only 1 of the Column A values are in the ranges in Columns B & C, so, hope I understand correctly:


Excel 2010
ABCD
1Codes(VALUES)HS Range FromHS Range ToEC18 Statement
2940360909093070000009307000000No
3940360909094016910009401699000No
4940360909094019000309401900030No
5940360909094033000109403609090Yes
6940360909095042000009504200000No
7940360909095081000119508100020No
8940360909096011000009601900000No
9940360909096140011009614001100No
10940360909096151900009615190000No
11940360909097030000009703000000No
12940360909097050000009706000090No
13940360909098970000009897000000No
Sheet22
Cell Formulas
RangeFormula
D2=IF(AND(A2>=B2,A2<=C2),"Yes","No")


D2 formula copied down.
 
Upvote 0

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