Vba to get related cell values

Azhar0554

New Member
Joined
Oct 16, 2017
Messages
10
Hi Im new to VBA. I have a question below it would helpful if i got the answer

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Department[/TD]
[TD]Sub_ID[/TD]
[TD]ID[/TD]
[/TR]
[TR]
[TD]8585[/TD]
[TD]00_A01[/TD]
[TD]00_A[/TD]
[/TR]
[TR]
[TD]9585[/TD]
[TD]01_B20[/TD]
[TD]01_B[/TD]
[/TR]
[TR]
[TD]1010[/TD]
[TD]00_C50[/TD]
[TD]00_C[/TD]
[/TR]
[TR]
[TD]2025[/TD]
[TD]05_P20[/TD]
[TD]05_P[/TD]
[/TR]
</tbody>[/TABLE]

I have the above table for data.I want function/sub to search and get/return the value in Sub_Id and ID based on Department value.

The above table is example i have the sheet with 10000 rows

Thanks in advance
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Hi, sounds like you want VLOOKUP() for example:


Excel 2013/2016
ABCDEFG
1DepartmentSub_IDIDDepartmentSUB_IDID
2858500_A0100_A958501_B2001_B
3958501_B2001_B
4101000_C5000_C
5202505_P2005_P
Sheet1
Cell Formulas
RangeFormula
F2=VLOOKUP($E2,$A$2:$C$5,2,0)
G2=VLOOKUP($E2,$A$2:$C$5,3,0)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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