Function for selecting the cell

Aspharagus

New Member
Joined
Aug 18, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am looking for a excel function which can select the cells in which the value I am looking for falls within.
for example, On column A I have values in degrees and column B has values which excel function has to find it for me.
Sometimes the degrees I am looking for falls between the degrees I have in column A, for that I need to do the linear interpolation and to do that, I need the column B value from the previous and after values.
I am looking for function which does that.
 

Attachments

  • example.JPG
    example.JPG
    61.7 KB · Views: 3

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hello, this should return exact match if there is one, if there is not it should return closest from below and above:

Excel Formula:
=XLOOKUP(K2,A3:A14,B3:B14,XLOOKUP(K2,A3:A14,B3:B14,,{-1,1}))
 
Upvote 0
Thanks Mate, this works!. Also please could you provide any way to find the value if the degree lies between 330 to 0 since it is forming the circle.
 
Upvote 0
Hello, I was wondering... my bad of course... Something like this then:

Excel Formula:
=IF(AND(K2>330,K2<=360),CHOOSEROWS(B3:B14,1,-1),XLOOKUP(K2,A3:A14,B3:B14,XLOOKUP(K2,A3:A14,B3:B14,,{-1,1})))
 
Upvote 0

Forum statistics

Threads
1,221,498
Messages
6,160,161
Members
451,627
Latest member
WORBY10

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