+ Reply to Thread
Results 1 to 7 of 7

How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

  1. #1
    Registered User
    Join Date
    02-21-2021
    Location
    Manila
    MS-Off Ver
    O365 16:61
    Posts
    54

    How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

    Hi all,

    In Sheet 1 there are two columns ie. B:B=SKU and Batch no., C:C=Quantity
    In Sheet 2 each SKU is divided into 4 columns: 1-SKU and Batch no, 2-Quantity, 3-Value, 4-Unit price.

    Problem A: I need to get the quantity adjacent to each 'SKU and Batch no' item in Sheet2 and return the results in C3 of Sheet1 and be able to copy down to the rest of C:C. I tried INDEX(Sheet2!B3:Y16, MATCH(Sheet1!B3, Sheet2!B3:Y16, 0) +1) without success. INDEX(Sheet2!C:C, MATCH(Sheet1!B3, Sheet2!B:B, 0)) would work but is limited as it cannot be copied down.
    Problem B: Can the resulting formula be tweaked to also fetch Value and Unit price from Sheet2?

    Note A: Columns in Sheet1 will extend down and each four-column-SKU in Sheet2 will extend indefinitely to the right as items are received.
    Note B: Quantities in Sheet2 gets updated as new items are received and recorded in a separate 'Good received' Sheet3.

    I'm at wits end and need help. Thank you.
    Attached Files Attached Files
    Last edited by aswethink; 02-21-2021 at 07:33 PM. Reason: To provide more context

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

    Hi aswethink and welcome to the forum.

    The data on sheet 2 is wrong. You shouldn't use merged cells and it should go down columns in rows instead of across. See the attached with a small data restructure and a VLookup answer.
    VLookup after data format.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    02-21-2021
    Location
    Manila
    MS-Off Ver
    O365 16:61
    Posts
    54

    Re: How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

    Hi MarvinP,

    Thanks for welcoming me to the forum. The headers on Sheet2 are formatted as horizontally aligned to centre across selection, they only look merged visually.

    I did come up with a partial solution - two way lookup using VLookup - but this returns values only for SKU1(pls see attached file) - and think it can be improved by nesting the formula in another lookup based on the first header row (perhaps Index Match with multiple criteria).

    However, you're right, I realised why complicate things. So, following your advice I simply added two more columns to the left, which will be the data Sheet1 would lookup against. The horizontal layout was retained and will fetch data from the added columns.

    Thank you!
    Attached Files Attached Files

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

    Hi aswethink,

    Another problem with your structure is in row 2. In a table of Excel data you should have different words for each column head. You repeat the words like "QTY", "Value", etc across in row 2. Excel has lots of problems with this type of repeated column heads.

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

    I don't like the way that SKU number and batch number are combined on sheet 1.

    EITHER they need to be separated into two columns OR we need CLEAR and ABSOLUTE rules. This formula works, for your sample SOLELY on the basis that the batches always begin with the word "Batch". If they don't, then they almost certainly will HAVE to be in a separate column:

    =INDEX(INDEX(Sheet2!$B$3:$Y$11,,MATCH(LEFT(B3,SEARCH("Batch",B3)-2),Sheet2!$B$1:$Y$1,0)+1),MATCH(B3,INDEX(Sheet2!$B$3:$Y$11,,MATCH(LEFT(B3,SEARCH("Batch",B3)-2),Sheet2!$B$1:$Y$1,0)),0))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  6. #6
    Registered User
    Join Date
    02-21-2021
    Location
    Manila
    MS-Off Ver
    O365 16:61
    Posts
    54

    Re: How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

    Hi Glenn,

    What I did wrong was oversimplify the sample file as I tried to follow the forum rules. In the actual file, SKU number and batch number have their own columns, but concatenated to try and match data in Sheet2, where SKU and Batch nos. are listed under a single column. I've rewritten the sample file to better reflect the actual file without formulas. Please see attached.
    Attached Files Attached Files
    Last edited by aswethink; 02-22-2021 at 04:42 PM.

  7. #7
    Registered User
    Join Date
    02-21-2021
    Location
    Manila
    MS-Off Ver
    O365 16:61
    Posts
    54

    Smile Re: How to return value in column adjacent to item in Sheet2 and return results in Sheet1?

    Hi Glenn,

    I made it work in the updated sample file. I separated the SKU and Batch Numbers into two columns as you suggested, but still used a third, helper column to concatenate the two for use as reference.

    = INDEX(INDEX(FIFO!$L$3:$AI$9,,MATCH(B3,FIFO!$L$1:$AI$1,0)+1),MATCH(E3,INDEX(FIFO!$L$3:$AI$9,,MATCH(B3,FIFO!$L$1:$AI$1,0)),0))

    FIFO=Sheet2 in the original

    MANY THANKS to both you and MarvinP!
    Attached Files Attached Files
    Last edited by aswethink; 02-22-2021 at 05:39 PM.

+ 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. [SOLVED] VBA search for 2 cells from Sheet1 on Sheet2 & return another cell from same row to Sheet1
    By Gordon85 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-30-2020, 04:01 PM
  2. Replies: 2
    Last Post: 09-23-2017, 01:34 AM
  3. Replies: 1
    Last Post: 01-24-2017, 11:33 PM
  4. Replies: 2
    Last Post: 07-14-2015, 04:32 PM
  5. [SOLVED] copy data from sheet1 to sheet2 based on column (A) sheet1 and column (C) sheet2
    By AWITCHER in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 05-13-2014, 03:20 PM
  6. [SOLVED] Simple formula to match column A, sheet1, with column A, sheet2, return text answer
    By Connie5761 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-14-2012, 02:56 PM
  7. compare Sheet1 against Sheet2 with highlighting results in Sheet1
    By mariposa in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-27-2011, 12:17 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