Two way lookup with a range of cells

babywong

New Member
Joined
Aug 2, 2007
Messages
2
Hi, I have a 2 way lookup that I can use index and match function for, but the problem is my columns and rows are in ranges. For example

20-25 26-30
0-5 2 4
6-10 4 6
11+ 6 8

The index and match function will work if I create a table column 0, 1, 2, 3, 4, 5, etc and row with 20, 21, 22, 23, etc.

And the Vlookup will work, assuming I don't have a double lookup.

How do I do a vlookup with ranges in the columns and rows?

Thanks for your assistance in advance.

Kathy[/img]
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi Kathy
Welcome to the board

You did not define exactly the syntax of the row/column values.

I assumed:

Either (low limit)-(high limit) Example 20-25

Or (low limit)+ Example 11+

With these assumptions I post a solution.

Remark. If the syntax for the row/column values is more complex maybe it's better to do this in vba, using a with a UDF. Even with only these 2 cases the formula is already somewhat complex and you might already want to do this with vba.

Hope this helps
PGC

<table border="1" cellpadding="1" style="background:#FFF; border-collapse:collapse;border-width:2px;border-color:#CCCCCC;font-family:Arial,Arial; font-size:10pt" ><tr><th style="border-width:1px;border-color:#888888;background:#9CF " > </tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >A</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >B</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >C</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >D</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >E</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >F</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >G</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >H</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >I</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >J</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >K</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >L</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >M</tr></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >3</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >4</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_02</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >5</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >20-25</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >26-30</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >6</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_01</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >0-5</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >101</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >102</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_01</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >1</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >5</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >7</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >9</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >11</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >13</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >7</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >6-10</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >103</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >104</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_02</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >20</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >26</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >29</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >21</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >30</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >20</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >8</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >11+</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >105</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >106</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Result</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >101</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >102</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >104</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >103</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >106</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >105</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >9</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td colspan=14 style="background:#9CF; padding-left:1em" > [Book1]Sheet1</td></tr></table>



<table border="1" cellpadding="1" style="background:#FFF; border-collapse:collapse;border-width:2px;border-color:#CCCCCC;font-family:Arial,Arial; font-size:10pt" ><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF " >Addr</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF " >Formula</td></tr><tr><td colspan=2 style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF " >[Book1]Sheet1</td></tr><tr><td rowspan=3 style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:center" >G8</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" > =INDEX($C$6:$D$8,MIN(IF(ISNUMBER(FIND("-",$B$6:$B$8)),IF((G6>=LEFT($B$6:$B$8,FIND("-",$B$6:$B$8)-1)+0)*(G$6<=RIGHT($B$6:
$B$8,LEN($B$6:$B$8)-FIND("-",$B$6:$B$8))+0),ROW($B$6:$B$8)-ROW($B$6)+1),IF(G$6>=LEFT($B$6:$B$8,FIND("+",$B$6:$B$8)-1)+0,
ROW($B$6:$B$8)-ROW($B$6)+1))),MIN(IF(ISNUMBER(FIND("-",$C$5:$D$5)),IF((G$7>=LEFT($C$5:$D$5,FIND("-",$C$5:$D$5)-1)+0)*(G$
7<=RIGHT($C$5:$D$5,LEN($C$5:$D$5)-FIND("-",$C$5:$D$5))+0),COLUMN($C$5:$D$5)-COLUMN($C$5)+1),IF(G$7>=LEFT($C$5:$D$5,FIND(
"+",$C$5:$D$5)-1)+0,COLUMN($C$5:$D$5)-COLUMN($C$5)+1)))) </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" > This in an array formula and so MUST be confirmed with CTRL+SHIFT+ENTER and not just ENTER.</td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" > Copy accross</td></tr></table>
 
Upvote 0
And this is a vba solution.

- It accepts a looser syntax, with possible spaces between the numbers and the signs, ex. "2-4", "2 -4", "2 - 4", "11 +"
- the rows/columns can be defined with just one number (like in the example I post in the columns' headers there's a cell with just 26).

Hope this helps
PGC

<table border="1" cellpadding="1" style="background:#FFF; border-collapse:collapse;border-width:2px;border-color:#CCCCCC;font-family:Arial,Arial; font-size:10pt" ><tr><th style="border-width:1px;border-color:#888888;background:#9CF " > </tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >A</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >B</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >C</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >D</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >E</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" >F</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >G</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >H</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >I</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >J</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >K</tr><th style="border-width:1px;border-color:#888888;background:#9CF; text-align:center" width=30 >L</tr></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >3</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >4</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_02</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >5</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >20 - 25</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >26</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >27- 30</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >6</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_01</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >0-5</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >101</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >102</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >103</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >7</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >6 -10</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >104</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >105</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >106</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >8</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >11 +</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >107</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >108</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >109</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >9</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >10</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >11</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >12</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_01</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >1</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >5</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >7</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >9</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >11</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >8</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >13</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >0</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >15</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >13</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Val_02</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >20</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >26</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >29</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >26</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >30</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >22</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >26</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >27</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >25</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >14</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:left" style="border-width: 1px;border-color:#888888" >Result</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >101</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >102</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >106</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >105</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >109</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >104</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >108</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >103</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" >107</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF; text-align:center" >15</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:right" style="border-width: 1px;border-color:#888888" > </td></tr><tr><td colspan=13 style="background:#9CF; padding-left:1em" > [Book1]Sheet1</td></tr></table>



<table border="1" cellpadding="1" style="background:#FFF; border-collapse:collapse;border-width:2px;border-color:#CCCCCC;font-family:Arial,Arial; font-size:10pt" ><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF " >Addr</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF " >Formula</td></tr><tr><td colspan=2 style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="background:#9CF " >[Book1]Sheet1</td></tr><tr><td rowspan=2 style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" style="text-align:center" >C14</td><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" > =RangesGetValue($C$5:$F$8,C12,C13) </td></tr><tr><td style="border-width:1px;border-color:#888888; padding-left:0.5em; padding-top:0.25em; padding-right:0.5em; padding-bottom:0.25em" > Copy accross</td></tr></table>


Code:
Function RangesGetValue(rTable As Range, lTableRow As Long, lTableColumn As Long)
Dim lRow As Long, lColumn As Long

lRow = GetCoordinate(rTable.Columns(1).Resize(rTable.Rows.Count - 1).Offset(1).Cells, lTableRow, True)
lColumn = GetCoordinate(rTable.Rows(1).Resize(1, rTable.Columns.Count - 1).Offset(, 1).Cells, lTableColumn, False)
RangesGetValue = Cells(lRow, lColumn)
End Function


Function GetCoordinate(rVal_Headers As Range, lVal As Long, bRow As Boolean)
Dim rCell As Range, oMatch As Object

With CreateObject("vbscript.regexp")
    .Pattern = "^(\s*(\d+)\s*|\s*(\d+)\s*\-\s*(\d+)\s*|\s*(\d+)\s*\+\s*)$"
    
    On Error Resume Next
    For Each rCell In rVal_Headers
    
        Set oMatch = .Execute(rCell.Value)(0)
        If Err > 0 Then
            Err.Clear
        Else
            If (oMatch.submatches(1) = lVal) Or _
               ((oMatch.submatches(2) <> "") And (oMatch.submatches(2) <= lVal) And (oMatch.submatches(3) >= lVal)) Or _
               ((oMatch.submatches(4) <> "") And (oMatch.submatches(4) <= lVal)) Then
            
                GetCoordinate = IIf(bRow, rCell.Row, rCell.Column)
                Exit For
            End If
        End If
    Next rCell
End With

End Function
 
Upvote 0

Forum statistics

Threads
1,222,068
Messages
6,163,720
Members
451,854
Latest member
Tiffany Smith

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