I have account codes that look like this #######-###-##-######. After the first (-) ###, is the department code.
In sheet "acct_codes" all of the full account codes are listed and in sheet "dept_list" all of the departments are listed.
I have a sheet called "lookup", in cell B2 of that sheet the user can enter a department code in cell B2 or double-click a department code in the "dept_list" sheet and it'll populate cell B2. And click a "search" button. Clicking that search button will trigger a macro taking the user to a separate sheet called "deptlookup". I would like for all of the account codes that have the department code being searched for, to be listed in Column A of the "deptlookup" sheet. So, if the user enters '001' in cell B2 and clicks search button, it will take them to the sheet 'deptlookup' and in column A it will list all of the account codes that have the department code '001' inside of it. I tried using a VLOOKUP for it but I believe the logic in my formula is off:
=IF(lookup!B2=MID(acct_codes!A:A,9,3),VLOOKUP(acct_codes!A:A=MID(acct_codes!A:A,9,3),acct_codes!A:A,1,FALSE), "")
If anyone can help me with this VLOOKUP formula or knows of an easier way to do this, I would be very grateful for any help. Thanks!
In sheet "acct_codes" all of the full account codes are listed and in sheet "dept_list" all of the departments are listed.
I have a sheet called "lookup", in cell B2 of that sheet the user can enter a department code in cell B2 or double-click a department code in the "dept_list" sheet and it'll populate cell B2. And click a "search" button. Clicking that search button will trigger a macro taking the user to a separate sheet called "deptlookup". I would like for all of the account codes that have the department code being searched for, to be listed in Column A of the "deptlookup" sheet. So, if the user enters '001' in cell B2 and clicks search button, it will take them to the sheet 'deptlookup' and in column A it will list all of the account codes that have the department code '001' inside of it. I tried using a VLOOKUP for it but I believe the logic in my formula is off:
=IF(lookup!B2=MID(acct_codes!A:A,9,3),VLOOKUP(acct_codes!A:A=MID(acct_codes!A:A,9,3),acct_codes!A:A,1,FALSE), "")
If anyone can help me with this VLOOKUP formula or knows of an easier way to do this, I would be very grateful for any help. Thanks!