Vlookup or Visual Basic help

Co1e

New Member
Joined
Jul 11, 2024
Messages
5
Office Version
  1. 2010
Platform
  1. Windows
Thanks for letting me join. I'm way over my head and neck deep. LOL

This is for a charity that serves people with disabilities I'm trying to help out.

(Capture 1 Image) I need multiple drop down list that replaces the text of the available selections with a numerical number. For example when the user selects a County from a drop down list the associated County Code is placed in that cell. Same for the Disability and it's code, Service and its code.

(Capture 2 & 3 Image, different tab/sheet) I was able to get it to work once, Capture 2 image cell I30, using some code copied from a Youtube video, Capture 3 image, but have issues trying to make it work again. Probably cause I know nothing on the Visual Basic basics.

The end goal would be to have the user be able to enter clients served by the charity and have these codes populate the spreadsheet that will be sent to the funding authority for quarterly reports. Thanks in advance for any help pointing me in the right direction. :-)

Capture 1.JPG
Capture 2.JPG
Capture 3.JPG
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Welcome to the Board!

Why do you need VBA at all? Can't you just set it up using VLOOKUP formulas?
You can pre-populate the sheet with all the formulas you need, and hide them until there is a value in the lookup cell, i.e.
if we are looking up a value in cell I30, we could write a formula structured like:
Excel Formula:
=IF(I30="","",VLOOKUP(I30,...))

This essentially says if I30 is blank, return nothing. Otherwise, do the VLOOKUP on the value in cell I30 and return that.
 
Upvote 0
Welcome to the Board!

Why do you need VBA at all? Can't you just set it up using VLOOKUP formulas?
You can pre-populate the sheet with all the formulas you need, and hide them until there is a value in the lookup cell, i.e.
if we are looking up a value in cell I30, we could write a formula structured like:
Excel Formula:
=IF(I30="","",VLOOKUP(I30,...))

This essentially says if I30 is blank, return nothing. Otherwise, do the VLOOKUP on the value in cell I30 and return that.
Thank you. I'll work that idea and see if I can get it done and post back success or failure. Hopefully success. Much appreciated. :)
 
Upvote 0
You are welcome.

Be sure to post back if you run into any issues trying to get it set up!
 
Upvote 0
Hey @Joe4 lil' update. Worked on this on and off a bit over the last day and still no luck. I probably didn't describe the issue as well as I could have. I did find an almost an exact issue thread on here return alternate value based on dropdown selection - Data Validation

I'm pretty sure it's going to take the VB script to get it done. I need this type function on three different columns with 3 different tables. I reached out to one of my friends at Bible study who's good with VB for a little help. If and when he can solve that issue I'll probably still have to ask for some help here again as I pretty it up putting the data tables on a separate sheet tab and the columns with the dropdown list on another sheet.

Little exclamation point says be sure to "Mark as solution". May be a week or so before I hear back from my buddy. I just wanted to come back here and provide a lil' update. And while I'm here thank you again for the help. Post back again when there is progress. :cool::cool::cool:
 
Upvote 0
As Joe says do you need the VBA? You could just put data validation on the relevant columns (Dis, County), then return the code using VLOOKUP into an adjacent column.

Like so:
Book1
ABCDEFGHIJKL
1DisabilityDis codeCountyCounty code
2ADD1Cherokee10
3Epilepsy9Jackson36
4Other16Lauderdale39
5
6
7
8
9Case #NameDescSCSexAgeDisDis CodeDateCountyCounty CodeAction
10Epilepsy9Jackson36
11
Sheet1
Cell Formulas
RangeFormula
H10H10=VLOOKUP(G10,Table1[#All],2)
K10K10=VLOOKUP(J10,Table2[#All],2)
Cells with Data Validation
CellAllowCriteria
G10List=$A$2:$A$4
J10List=$D$2:$D$4
 
Upvote 0
As Joe says do you need the VBA? You could just put data validation on the relevant columns (Dis, County), then return the code using VLOOKUP into an adjacent column.

Like so:
Book1
ABCDEFGHIJKL
1DisabilityDis codeCountyCounty code
2ADD1Cherokee10
3Epilepsy9Jackson36
4Other16Lauderdale39
5
6
7
8
9Case #NameDescSCSexAgeDisDis CodeDateCountyCounty CodeAction
10Epilepsy9Jackson36
11
Sheet1
Cell Formulas
RangeFormula
H10H10=VLOOKUP(G10,Table1[#All],2)
K10K10=VLOOKUP(J10,Table2[#All],2)
Cells with Data Validation
CellAllowCriteria
G10List=$A$2:$A$4
J10List=$D$2:$D$4
That's workable for sure. Totally cool! I'd just have to have the coordinators enter data on one sheet then transfer the columns needed to the sheet with Names, DOB that can be sent to the funding agency. The funding agency doesn't need the disability name just the code not do they want the private info.

Thanks. A work in progress and all the progress part is thanks to this forum.
 
Upvote 0
columns needed to the sheet with Names, DOB OMITTED that can be sent to the

Edit to add omitted :-)
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

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