# Select Value +Return Value Based on Data Location.

#### Roj47

##### Board Regular
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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

#### Fluff

##### MrExcel MVP, Moderator
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’)

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

#### Roj47

##### Board Regular
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’)

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
You're welcome & thanks for the feedback.

##### Active Member
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

Replies
3
Views
62
Replies
6
Views
86
Replies
4
Views
99
Replies
1
Views
116
Replies
5
Views
444

1,141,613
Messages
5,707,402
Members
421,508
Latest member
Jalayne

### 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.

### Which adblocker are you using?

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

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