Aug 28 2018 06:45 AM
I am trying to create IF VBA statements. FYI-I have no knowledge of writing VBA language.
The goal is to create a template for users to use when when requesting wire transfers. On this template there is a Transfer Funds From section and a Transfer Funds To section. Under each section there are information that is needed in order to transfer funds.
Transfer Funds From Section
Information required are:
Transfer Funds To Section
Information required are:
I would like that if the user enters the Agency under the Transfer Funds From Section then Bank Name and Account Number will automatically populate. So lets say the Agency's name is entered in cell C7 then the bank name associated with the agency should populate in cell C8 and the Account number associated with the Agency should populate in cell C9.
For the Bank Name I currently have a vLookup formula. So based on what the user entered in cell C7 the bank name would populate. However if I am going to use VBA I would rather use IF statements. For the account number I am currently using IF statements based on what is entered in C7 the account number is populated. Sample formula =IF(C7="Sneaker",99999999).
Under the Transfer Funds To Section if user enters the beneficiary name then the beneficiary address, receiving bank, ABA#, and Beneficiary Account Number will automatically populate. So lets say the beneficiary name is in cell C13 then the beneficiary address should populate in cell C14, receiving bank cell C15, ABA# cell C16, and beneficiary account number cell C17.
Note: in some cases we would not have the beneficiary address. I would also need the VBA language from start to finish.
Any assistance will be greatly appreciated.
Thanks much
Aug 28 2018 07:11 AM
Does it have to be VBA? From your description it sounds like it could all be achieved by having a table with the details in and then using more vlookups or index(match()).
Aug 28 2018 07:18 AM
Aug 28 2018 07:20 AM
I am not familiar with the index/match. I tried to do some research on it but was unsuccessful with making it work for my situation do to lack of knowledge.
Aug 28 2018 10:36 AM - edited Aug 28 2018 10:37 AM
Hi LaToya, no worries..
It would help a little if you could upload an workbook that shows the structure of your data and what the end result should look like.
Aug 28 2018 12:34 PM
Solutionhia,
thanks for that. I've attached what I think solves your problem.
on sheet1 i've added 2 tables, one is called tbl_to and one is called tbl_from that contains the details of the accounts.
Then on your template i've added the index match for the various rows. If you change the names you should see the account details change.
Aug 29 2018 05:13 AM
Thank you so much Philip!!! You are the best!!! This worked perfectly!!!
Aug 29 2018 05:34 AM
Super! Here is a tutorial that explains how index match works:
https://www.deskbright.com/excel/using-index-match/
Its a pretty useful technique, well worth learning.
Aug 29 2018 09:03 AM
Philip,
Your workbook works great. If I may offer two suggestions though. The drawback to the way your data validation dropdown is referenced, is that you have to manually update the reference each time you add a row normally, by pressing Tab from the bottom right cell of the table. You could create a named range using the table column, that you can then reference in the data validation which will not have to be updated. If you right click in the table, and select insert row, this isn't an issue, but one of the reasons I like tables, is that you can enter info and just keep tabbing to keep going on to the next row. I would also unlock the 2 dropdown cells, and protect the sheet. I've probably over-analyzed this, but it comes from having to un-break forms that I've created for others.
Aug 29 2018 09:30 AM
Hia Bob,
nope you are abolutly right, my normal preference is to use a table to hold the options and then use =indirect("tbl_name[column]") as the validation list.
I actually only added a validation list here because i made up the extra people in the example list and thought that it might help see the example work if i limited the options.
Also good idea about protecting the sheet, nothing worse then getting everything working and then someone acidently breaking everything right away :D
Aug 28 2018 12:34 PM
Solutionhia,
thanks for that. I've attached what I think solves your problem.
on sheet1 i've added 2 tables, one is called tbl_to and one is called tbl_from that contains the details of the accounts.
Then on your template i've added the index match for the various rows. If you change the names you should see the account details change.