Hello, I have a corporate org chart for which I am trying to write a macro. The Excel workbook is set up so that each company is in a unique cell. The subsidiary is one column to the right. For instance, I would like to return the values in the far right column for the data below. Thank you.
COL
A B C F
AAA
BBB AAA
CCC AAA
DDD CCC
EEE AAA
Software/Hardware used:
Excel 2003
ASKED:
December 15, 2010 3:53 PM
UPDATED:
March 11, 2011 3:38 PM
I have created a similar chart using Excel to link all the company payroll to a telephone number and department. Although this was a telephone directory, the search is similar. I needed a contact number to be returned, and you need a department for an individual.
I did not actually use a macro like yours, but i did use tables. A table for department, and another for telephone number. This was ideal, because some departments and some telephone numbers had multiple entries.
I suggest putting repeated data in look-up tables, and link each column to them. The macro can be written quite simply to look up the source in the table and return the content of the relevant row.
example (I’m using departments, but you substitute the company name)
Department Lookup table layout. (called department_table in lookup)
Ref#, Department
1, Finance
2, Production
3, et cetera, et cetera
Reference data sheet layout
Ref#, Person details, department_code, department
1, Mike Jones, 1 , =VLOOKUP(“department_code”,department_table,2,FALSE)
2, John smith, 2, =VLOOKUP(“department_code”,department_table,2,FALSE)
3, et cetera, et cetera, et cetera
This is an easier method, as each formula is identical, so, if changes need to be made, they only have to be done in the table, and not the lookup formula.
Hope this helps.