Vlookup to get all the values from given dataset

harinsh

Active Member
Joined
Feb 7, 2012
Messages
273
Hi Team,

I hope anyone can help me with below requirement. When we do vlookup ...we only get value based on look up or same row values based on the position of the column.

I need something different like need to get the values based look up and next lookup value should not be same value ...and it should be next against lookup value.

Here is the input and output examples for my requirement ( I can't sort the data which I have)

[TABLE="width: 128"]
<colgroup><col width="64" span="2" style="width:48pt"> </colgroup><tbody>[TR]
[TD="class: xl64, width: 64"]
Input :
Emp No[/TD]
[TD="class: xl64, width: 64"]

Values[/TD]
[/TR]
[TR]
[TD="class: xl63"]111111[/TD]
[TD="class: xl64"]50[/TD]
[/TR]
[TR]
[TD="class: xl63"]111111[/TD]
[TD="class: xl64"]53[/TD]
[/TR]
[TR]
[TD="class: xl63"]222222[/TD]
[TD="class: xl64"]34[/TD]
[/TR]
[TR]
[TD="class: xl63"]222222[/TD]
[TD="class: xl64"]32[/TD]
[/TR]
[TR]
[TD="class: xl63"]333333[/TD]
[TD="class: xl64"]66[/TD]
[/TR]
[TR]
[TD="class: xl63"]333333[/TD]
[TD="class: xl64"]54[/TD]
[/TR]
[TR]
[TD="class: xl63"]444444[/TD]
[TD="class: xl64"]88[/TD]
[/TR]
[TR]
[TD="class: xl63"]111111[/TD]
[TD="class: xl64"]86[/TD]
[/TR]
[TR]
[TD="class: xl63"]222222[/TD]
[TD="class: xl64"]34[/TD]
[/TR]
[TR]
[TD="class: xl63"]222222[/TD]
[TD="class: xl64"]23[/TD]
[/TR]
</tbody>[/TABLE]

Ouput:
[TABLE="width: 128"]
<tbody>[TR]
[TD="class: xl67, width: 64"]Emp ID[/TD]
[TD="class: xl67, width: 64"]Values[/TD]
[/TR]
[TR]
[TD="class: xl66"]111111
[/TD]
[TD="class: xl65, align: right"]50
[/TD]
[/TR]
[TR]
[TD="class: xl66"]111111
[/TD]
[TD="class: xl65, align: right"]53
[/TD]
[/TR]
[TR]
[TD="class: xl66"]111111
[/TD]
[TD="class: xl65, align: right"]86
[/TD]
[/TR]
[TR]
[TD="class: xl66"]222222
[/TD]
[TD="class: xl65, align: right"]34
[/TD]
[/TR]
[TR]
[TD="class: xl66"]222222
[/TD]
[TD="class: xl65, align: right"]32
[/TD]
[/TR]
[TR]
[TD="class: xl66"]222222
[/TD]
[TD="class: xl65, align: right"]34
[/TD]
[/TR]
[TR]
[TD="class: xl66"]222222
[/TD]
[TD="class: xl65, align: right"]23
[/TD]
[/TR]
[TR]
[TD="class: xl66"]333333[/TD]
[TD="class: xl68"] 66[/TD]
[/TR]
[TR]
[TD="class: xl66"]333333[/TD]
[TD="class: xl68"] 54[/TD]
[/TR]
[TR]
[TD="class: xl66"]444444[/TD]
[TD="class: xl68"] 88[/TD]
[/TR]
</tbody>[/TABLE]

[TABLE="width: 128"]
<tbody>[TR]
[TD="class: xl67, width: 64"]

[/TD]
[TD="class: xl67, width: 64"][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
<b>Array Formulas</b><table cellpadding="2.5px" width="100%" rules="all" style="border: 1px solid;text-align:center;background-color: rgb(255,255,255);border-collapse: collapse; border-color: rgb(187,187,187)"><thead><tr style=" background-color: rgb(218,231,245);color: rgb(22,17,32)"><th width="10px">Cell</th><th style="text-align:left;padding-left:5px;">Formula</th></tr></thead><tbody><tr><th width="10px" style=" background-color: rgb(218,231,245);color: rgb(22,17,32)">F2</th><td style="text-align:left">{=INDEX(<font color="Blue">$B$2:$B$11,SMALL(<font color="Red">IF(<font color="Green">$E2=$A$2:$A$11,ROW(<font color="Purple">$B$2:$B$11</font>)-ROW(<font color="Purple">$B$2</font>)+1</font>),COUNTIFS(<font color="Green">$E$2:$E2,$E2</font>)</font>)</font>)}</td></tr></tbody></table><b>Entered with Ctrl+Shift+Enter.</b> If entered correctly, Excel will surround with curly braces {}.</td></tr></table><br />




Excel 2013/2016
ABCDEF
1Emp NoValuesEmp IDValues
21111115011111150
31111115311111153
42222223411111186
52222223222222234
63333336622222232
73333335422222234
84444448822222223
91111118633333366
102222223433333354
112222222344444488
Sheet3
 
Upvote 0

Forum statistics

Threads
1,225,477
Messages
6,185,216
Members
453,283
Latest member
Shortm88

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