Macro to Select an Item from and array

johnt3943

New Member
Joined
Sep 16, 2011
Messages
2
I need a macro to select an item from an array based on an IS statement. The array is arranged in ascending order.


Col A Col B Col C Col D
5 1 A 1.1
10 2 C 1.5
15 3 D 2.0
20 6 F 4.0
25 9 H 6.0
30 2 K 7.0

Now my comparison number in a cell (say cell H5) is 21.2
I want to put 4.0 in cell H6.

I.e if H5 > A(x) Then H6 = D(x)

All help will be appreciated.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Thanks for the reply but the VLOOKUP with the TRUE argument only selects the closest Match.

I wanted any number greater that 20 and less than 25 to select the value 4.

I have figured it out with a VLOOKUP, with nested LARGE and COUNTIF functions
 
Upvote 0

Forum statistics

Threads
1,224,603
Messages
6,179,856
Members
452,948
Latest member
UsmanAli786

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