+ Reply to Thread
Results 1 to 8 of 8

Formula needed to return an array of items based on lookup value in another column

  1. #1
    Registered User
    Join Date
    04-16-2009
    Location
    Vancouver
    MS-Off Ver
    Excel 2007
    Posts
    5

    Formula needed to return an array of items based on lookup value in another column

    I have a sheet with inventory data

    A - stock code
    B - usage
    C - stock on hand
    D - item name

    Usage data is shown by month so there could be 0 - 12 rows for each stock code. Stock on hand is the current stock available (same for all rows of a single stock code).

    I need to find all cases where total usage for the year is 0, but we have stock on hand. That means for each stock code, I need to find all the rows where it appears and return a sum of usage for all rows. I would then like to display:

    stock code, total usage for year, stock on hand, item name

    I'm not sure what combination of functions can help me with this. VLOOKUP only returns the first instance of the stock code and usage. I need a function that will return an array of numbers (all usage values) or something to that effect. How can this be done?

    Thanks,
    Mike
    Last edited by VBA Noob; 04-16-2009 at 01:15 PM. Reason: Got lambasted :)

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Not sure which forumla to use

    Welcome to the Forum,

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    04-16-2009
    Location
    Vancouver
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Formula needed to return an array of items based on lookup value in another colum

    Fixed, apologies.

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula needed to return an array of items based on lookup value in another colum

    Thanks for taking the time to read and comply with the rule .

    Have you taken a look at the SUMIF() function...

    it sums values in one column based on criteria in another column...

    e.g. =Sumif(A1:A100,"X",B1:B100) this would sum values in B1:B100 where A1:A100 contains an "X"

  5. #5
    Registered User
    Join Date
    04-16-2009
    Location
    Vancouver
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Formula needed to return an array of items based on lookup value in another colum

    I did look at sumif() but still not quite sure how to make it work.

    Suppose:

    Please Login or Register  to view this content.
    I can write a single sumif, that is easy but how do you do it for all rows in the sheet? You don't know the range to use, you don't know "X".

  6. #6
    Registered User
    Join Date
    04-16-2009
    Location
    Vancouver
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Formula needed to return an array of items based on lookup value in another colum

    To summarize, this is the input I have and the output I'm trying to achieve:

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Formula needed to return an array of items based on lookup value in another colum


  8. #8
    Registered User
    Join Date
    04-16-2009
    Location
    Vancouver
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Formula needed to return an array of items based on lookup value in another colum

    That looks promising, thanks. I'll go read up on that and see if I can make it work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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