Select Value +Return Value Based on Data Location.

Roj47

Board Regular
Joined
May 4, 2011
Messages
56
Office Version
  1. 365
Platform
  1. Windows
Hi, and do feel a little daft asking this as it seems so easy (?).

I have data (numeric e.g. 47 and test e.g. DT) which are entered into a handful of cells in a row.

There are 10 columns (D to M) with the current most recent position as you get to M.

Is there a function that I can enter into Column N to return the entered value closest to Column N i.e.

If Column E has 47, I would like Column N to return 47; If I enter DT into column L, then the value in Column N returns DT.... Likewise if I remove DT from column L the value reverts back to 47.

Searching keeps helping me get the closest value in a different way.

Thank you.
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,546
Office Version
  1. 365
Platform
  1. Windows
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=LOOKUP(2,1/(D2:M2<>""),D2:M2)
 
Solution

Roj47

Board Regular
Joined
May 4, 2011
Messages
56
Office Version
  1. 365
Platform
  1. Windows
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

How about
Excel Formula:
=LOOKUP(2,1/(D2:M2<>""),D2:M2)

I have checked the 365 option and my platform - Thank you for pointing out this had not happened.

The solution was perfect, thank you on this also.
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
62,546
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

EFANYoutube

Active Member
Joined
May 19, 2017
Messages
278
This is what I got
Excel Formula:
=IFERROR(IF(IFERROR(XMATCH(47,D1:M1,0,-1),0)>IFERROR(XMATCH("DT",D1:M1,0,-1),0),INDEX(D1:M1,1,XMATCH(47,D1:M1,0,-1)),INDEX(D1:M1,1,XMATCH("DT",D1:M1,0,-1))),"None")
Fluffs is better, I misread your post in thinking those were the only 2 things you wanted to test for
 

Forum statistics

Threads
1,141,618
Messages
5,707,430
Members
421,508
Latest member
someinternetuser

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
Top