# Excel 2007: Auto-populate from list

Hi, I'd like to have formulas in column B of Sheet1 to automatically populate a list of cost center based on the BU specified in column A.  Please help.  Thanks!
Auto-populate.xlsx
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Use Vlookup.  I will upload fix.  You have to switch the column orders in the Lookup sheet to use the function.

=VLOOKUP(B2,Lookup!\$A:\$B,2,FALSE)
Auto-populate-fix.xlsx
Author Commented:
This is not what I am looking for.  I'd like to be able to enter a BU in cell A2 and column B will be automatically populated all cost centers that belong to that BU.  For example, if I enter "A" in cell A2, column B will list 3 cost centers.  If I enter "B" in cell A2, column B will list 8 cost centers.  Thanks.
EngineerCommented:
If you can use a helper column then it will make life very easy. See attached.
Copy-of-Auto-populate-1-.xlsx

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thanks for the simple but effective formulas!
EngineerCommented:
These are the functions used in the file

=IFERROR(INDEX(Lookup!B:B,Sheet1!C2+1),"")

How does Sheet1!C2+1 above use as the row number?

=IFERROR(MATCH(Sheet1!\$A\$2,OFFSET(Lookup!\$A\$1,Sheet1!C1+1,0,10000),0)+C1,"")

The match function
=MATCH(Sheet1!\$A\$2,range below previous value,0)

returns the distance of the next occurrence of that BU after the previous BU based on the "range below previous value"

The "range below previous value" can be calculated using the formula

OFFSET(Lookup!\$A\$1,Sheet1!C1+1,0,10000)

which returns a range starting C1+1 rows after A1 and is 10000 rows long.
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.