Fins closest larger and smaller to and input number from another sheet and copy entire row

Obedan

New Member
Joined
Jan 5, 2016
Messages
6
I do not have any experience with VBA coding and I need your help to start learning.

I have two different sheets, The first one include the input from the user and should get the output as well.
99866575e06ab581897472bebfa3784c34f3408788605ae705e3579123e8048c57c910fc.jpg


The second sheet has all the data.

633141974fda12acfbac73e0d2ae308c1918df2d1a99e5a6c9ea7da1dbcfbd95e1ee679a.jpg


The user should input two variables D and W in the first sheet , The W value is fixed and the user will choose it from drop down list.

The code should find 2 rows with the same input W value and closest larger and closest smaller with respect to the value of D. Then it should copy these entire rows from sheet 2 to sheet 1.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Just add an IFERROR like this:

=IFERROR(yourFormulaHere,"")
 
Upvote 0
Will be helpful if you can explain your expected output vs what you are getting using an example.

Regards,
DILIPandey
 
Upvote 0

Forum statistics

Threads
1,215,527
Messages
6,125,337
Members
449,218
Latest member
Excel Master

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