+ Reply to Thread
Results 1 to 5 of 5

Script to Lookup and Return Multiple Values

  1. #1
    Registered User
    Join Date
    05-29-2018
    Location
    Portland, OR
    MS-Off Ver
    2016
    Posts
    12

    Script to Lookup and Return Multiple Values

    End Goal = Populate 2019 Plan Tab with values (Get location's budget value from Budget Tab and put it in the corresponding Period based on Schedule Tab & Calendar Tab)

    Macro =
    a) Find Location from 2019 Tab in Schedule Tab
    b) Get date from Column B on Schedule Tab
    c) Search date in Column A on Calendar Tab
    d) Get Period from Column B on Calendar Tab
    e) Search location from Column A in Schedule Tab
    f) Paste value in corresponding period based on result from d)

    Notes:
    - Each location will essentially 4 dates in the Schedule Tab, see location AD & AF for an example (in real life there will be 13 periods in total but all the columns from the schedule remain the same)

    I tried a couple of excel formulas but because the locations are across multiple columns and in more than 1 cell, the lookup returns an error or it returns just the first indication.
    Attached Files Attached Files

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Script to Lookup and Return Multiple Values

    Hi,

    This is clearly a much simplified example and probably doesn't represent the size of your actual data. We often find that when we give an answer to what is a trivial non representative example when the solution is used with the real world data it doesn't work because of factors like string length and other stuff which is important but hasn't been mentioned.

    Therefore upload your real workbook (or at least a cut down copy), and manually add the results you expect to see. Clearly identify which is original data and which are the results and in a note clearly explain how you have arrived at your results.

    Re b) when you say get date, which date? The current date..some other...
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    05-29-2018
    Location
    Portland, OR
    MS-Off Ver
    2016
    Posts
    12

    Re: Script to Lookup and Return Multiple Values

    Attached is the real workbook (cut down), in which the data is specific to a company ...

    The results I expect to see are on the first tab. All the other tabs are original data. My high level expectation is to run the macro and produce the data on the first tab (highlighted in yellow), all other data is original and will already be in the workbook when I run the macro. Date is already listed on the Schedule tab (column B) and Calendar tab (column A). They are both just all dates in a year.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,420

    Re: Script to Lookup and Return Multiple Values

    Here is a formula based proposal.
    On the 'Schedule' sheet column Z is populated with the periods using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    AA2:MB2 are populated by transpose copying the store numbers from the '2019 Plan' sheet.
    AA3:MB89 are populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    On the '2019 Plan' sheet columns C:O are populated using:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  5. #5
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,513

    Re: Script to Lookup and Return Multiple Values

    This works
    ARRAY formula in C4 then dragged across
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 03-10-2017, 07:56 PM
  2. Lookup and return multiple values
    By grifter0 in forum Excel General
    Replies: 3
    Last Post: 03-14-2016, 12:07 PM
  3. Replies: 4
    Last Post: 05-19-2015, 08:42 PM
  4. [SOLVED] Is it possible to lookup multiple values and return multiple rows of results?
    By justin11 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-20-2013, 12:02 PM
  5. lookup multiple values in multiple columns to return a result
    By AYAHOO123 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-11-2013, 07:53 PM
  6. Lookup to return multiple values
    By cispus78 in forum Excel General
    Replies: 2
    Last Post: 11-11-2008, 09:01 PM
  7. Lookup and return multiple Values
    By Neil in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 07:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1