vba match a range of numbers

monsierexcel

New Member
Joined
Nov 19, 2018
Messages
29
hey guys, i have a VBA coding problem and i am not sure if i need to write in index/match formula into my vba or if theres a better way to build this.

I have a list of numbers
1
test1
3
test2
5
test3
8
test4
11
test5
13
test6
15
test7

<tbody>
</tbody>


<tbody>
</tbody>

SO with this table iif my value produces "6" i want it to produce test 3 - as 5 is the nearest
I think its index/match i require but not sure how to write it in VBA?

thanks guys
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
This would do it as a formula (with CTRL-SHIFT-ENTER). Are you writing the value back to the sheet in your VBA code or what are you trying to do with that?


Excel 2010
ABCDE
11test16
23test2test3
35test3
48test4
511test5
613test6
715test7
Sheet1
Cell Formulas
RangeFormula
E2{=INDEX(B1:B7,MATCH(MIN(ABS($E$1-A1:A7)),ABS($E$1-A1:A7),0))}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,332
Members
449,077
Latest member
jmsotelo

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