Forum Discussion
AlokBeheria
May 17, 2023Brass Contributor
Vlookup unable to fetch desired values
Hello All,
I have 2 sheets in which I am trying to find vlookup to search values from 1 sheet and find the corresponding match from other sheet. For few rows , I am getting the results , but for few columns , I am getting #NA errors. In the following workbook, I have 2 sheets in which I need to find values for server and corresponding to it , DB name is displayed. what I want irrespective of row number if it find the match then it should able to display DB name. Not sure , if this can be done using vlookup. Also, tried to use INDEX and Match function , but unable to use it as I am st
Sheet 1 | Sheet 2 | ||||
row number | Server | DB Name | row number | Server | DB Name |
1 | sw252.phibred.com | AGILEPD | 10 | sw252.phibred.com | AGILEPD |
2 | sw46.phibred.com | AGILEQA | 14 | sw46.phibred.com | AGILEQA |
3 | lxjh823.phibred.com | biodev | 15 | lxjh823.phibred.com | biodev |
4 | sw251.phibred.com | BIOMART | 17 | sw251.phibred.com | BIOMART |
5 | lxjh833.phibred.com | bioneer | 35 | lxjh833.phibred.com | bioneer |
6 | lxjh826.phibred.com | bioneerq | 40 | lxjh826.phibred.com | bioneerq |
7 | sw251.phibred.com | BIOPRD | 45 | sw251.phibred.com | BIOPRD |
8 | lxjh843.phibred.com | bioprd | 67 | lxjh843.phibred.com | bioprd |
Reggards
Could you attach a small sample workbook demonstrating the problem (without sensitive data), with the formula you tried, or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?
- AlokBeheriaBrass Contributor
Hello Hans,
I uploaded the sample data where in I am trying to get values(DB_NAME) from "sheet 2" and you may discover that few rows , it's pulling up the values while other rows , it does shows #NA and which is where I am just trying to find a way to populate values from sheet 2.
Regards
The lookup is fairly useless, since the Host_name column on Sheet2 contains large numbers of duplicate values while the corresponding DB_Name values are different. VLOOKUP will simply return the first match that it encounters.
Apart from that, your lookup range in the formula in B2 is Sheet2!A1:B331. This is a relative reference, so it changes when you fill or copy the formula down. You should use Sheet2!$A$1:$B$331 (or use a named range or a table). You'll still have a few #N/A:
In B9 because there is no Host_name sw337 on Sheet2.
In B10 because there is no Host_name eluxd06 on Sheet2.