Linking fields

gosig

New Member
Joined
Nov 9, 2011
Messages
5
I am trying to put together a data entry template for flora survey data. I have created a dropdown list to select scientific name of flora species, linked to master list in a separate worksheet. I want other fields (such as Family Name and Common Name) to automatically fill as per the master list, based on the scientific name selected. For example purposes, if I select ‘Abutilon fraseri’ from the dropdown list for Scientific Name, I want ‘Dwarf Lantern-bush’ to automatically appear in the Common Name field as it does in the master list. I hope I have explained this clearly enough. I have played around with VBA code (e.g. trying VLOOKUP, IF, MATCH, GROUP, dependent list functions) for hours, and looked at forums but can’t work it out. Any help greatly appreciated.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the Board!

If I'm understanding you correctly, you don't need to use VBA code.
You would just need a lookup formula such as a VLOOKUP formula in each of those fields.

For example, the formula in the Common Name field might be:
=VLOOKUP(A2,'Lookup Sheet'!A:B,2,FALSE)
where A2 is your dropdown list cell
'Lookup Sheet' has your Master List in Column A and the Common Names in Column B
 
Upvote 0
Thankyou so much! That worked a treat. In some instances, a species does not have a common name. Using this formula, they are given '0'. Is there anyway to write the formula so that the field is left blank in such a case?

Again, many thanks. I never expected such a prompt reply!
 
Upvote 0
If you have Excel 2007 or later, you can use the IFERROR function...

=IFERROR(VLOOKUP(A2,'Lookup Sheet'!A:B,2,FALSE),"")

For earlier versions you would use ISERR
 
Upvote 0
ADVERTISEMENT
Perfect. Many, many thanks!
 
Upvote 0
Sorry, I was answering what to do if the Scientific Name selected isn't found in the lookup.
That shouldn't happen since you are using that as the source of the DropDown list.

The way you can avoid the 0 is

=IF(VLOOKUP(A2,'Lookup Sheet'!A:B,2,FALSE)=0,"",VLOOKUP(A2,'Lookup Sheet'!A:B,2,FALSE,2,0))

Alternatively, you can use Excel Options to setup your worksheet not to display zeros in blank cells.
 
Upvote 0
ADVERTISEMENT
I don't seem to be able to get the last formula to work. The linking of scientific and common name worked a treat, but I'm having trouble linking other fields back to scientific name (e.g. family name, legislative rating etc). I am assuming that perhaps the linked fields need to be side by side left to right in the master list?

Is there a way to link multiple fields, ie, such that based on the entry for scientific name, the fields for common name, family, conservation status all auto-fill, regardless of the order in which they appear in the datasheet. The way I currently have the data sheet set up, i have columns to be auto-filled to both the left and to the right of the scientific name column (in the same order as they appear in the master list).
 
Upvote 0
Yes, you just need to expand the number of columns in your lookup range along with the Index number of which column to look up. For example if Conservation Status is in Column D, and Scientific Name is still in Column A, this formula can be used to lookup Conservation Status.

=IF(VLOOKUP(A2,'Lookup Sheet'!A:D,4,FALSE)=0,"",VLOOKUP(A2,'Lookup Sheet'!A:D,4,FALSE,2,0))

If you check out the VLOOKUP in Excel's help, this will probably become clearer.
 
Upvote 0
Thanks Jerry, will do. I should be able to work it out from here. Thanks for getting me started.
 
Upvote 0

Forum statistics

Threads
1,196,323
Messages
6,014,637
Members
441,833
Latest member
Rangerreeve

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