Creating an autofill with multiple sources

DPChristman

Board Regular
Joined
Sep 4, 2012
Messages
171
Office Version
  1. 365
Platform
  1. Windows
I am trying to create a spreadsheet with auto-fills based on multiple pieces of information on a separate tab.

For example, in 2022, location number 123 might be in San Jose, CA.

However, in 2023, location number 123 was in San Francisco, CA.

With only once sources (ex. Location number), this is easy with a simple vlookup formula.

However, now the lookup depends on two pieces of information (year and store number).

So for example if the year column (column A) is 2022, and the location column (column B) is 123, the lookup formula in column C will bring up San Jose, CA.

This is something I am trying to put together for the first time, so I don't have any examples to post.

Is there an easy way to do this?

If I was just pulling a numeric value, I know that I could use a SUMIFS formula, but that doesn't work if you are pulling up non-numeric values.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Perhaps an IF statement, referencing the two different VLOOKUP formulas, i.e. something structured like this:
=IF(some condition, vlookup formula 1, vlookup formula 2)

It all depends on how your data is structured. Without seeing an example of your data, we cannot really provide specifics.
 
Upvote 0
Perhaps an IF statement, referencing the two different VLOOKUP formulas, i.e. something structured like this:
=IF(some condition, vlookup formula 1, vlookup formula 2)

It all depends on how your data is structured. Without seeing an example of your data, we cannot really provide specifics.
As I said, I haven't got anything put together yet, but this is an example of the data source tab, and how it would fill the entry tab.
Entering both the year and location number would autofill the remaining columns from the data source. The Data Entry would be on One Tab, and the data Source would be on the second.
 

Attachments

  • MULTI LOOKUP.JPG
    MULTI LOOKUP.JPG
    104.4 KB · Views: 4
Upvote 0
One quick and simple solution would be to create a "helper" column that sows your Year and Loc# fields together in the data you are looking up into, i.e.
Excel Formula:
=A3 & B3
Then you can use easily use a VLOOKUP or XLOOKUP formula to get what you want.
The nice thing about using XLOOKUP is you can place this helper column at the end of your data (instead of at the beginning, like VLOOKUP would require).
 
Upvote 0
Solution
One quick and simple solution would be to create a "helper" column that sows your Year and Loc# fields together in the data you are looking up into, i.e.
Excel Formula:
=A3 & B3
Then you can use easily use a VLOOKUP or XLOOKUP formula to get what you want.
The nice thing about using XLOOKUP is you can place this helper column at the end of your data (instead of at the beginning, like VLOOKUP would require).
That is an interesting alternative. We use helper columns in other spreadsheets. Kicking myself for not thinking of it. Each year will contain thousands of location entries.
I could likely convert all previous years to text, rather than formulas to reduce the file size. Thanks
 
Upvote 0
That is an interesting alternative. We use helper columns in other spreadsheets. Kicking myself for not thinking of it. Each year will contain thousands of location entries.
I could likely convert all previous years to text, rather than formulas to reduce the file size. Thanks
The marked solution has been changed accordingly. In your future questions, please mark the post as the solution that actually answered your question, instead of your feedback message as it will help future readers. No further action is required for this thread.
 
Upvote 0

Forum statistics

Threads
1,215,072
Messages
6,122,966
Members
449,094
Latest member
Anshu121

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