+ Reply to Thread
Results 1 to 8 of 8

return a value based on condition in 2 columns

  1. #1
    Registered User
    Join Date
    04-22-2008
    Posts
    4

    Question return a value based on condition in 2 columns

    I have 2 spreadsheets one populated with data that has 3 columns of Store#, Prod. Type, Sold Qty. There are multiple instances of the Store # and multiple instances of Prod. Type, but the combination of both is unique.

    The other spreadsheet has specific Store# and Product type chosen, I need to populate the sales qty for specific stores and specific product type.
    Please help me out, I cant seem to figure this out. Sample spreadsheets attached.

    Thank you,

    George
    Attached Files Attached Files
    Last edited by ShyGuy; 04-22-2008 at 12:22 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    You could add a new column to each sheet which concatenates the store and product.

    e.g. = A2 & "/" & B2

    You could then base your look-ups on this.
    Martin

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898
    Try this formula in B2:

    Please Login or Register  to view this content.
    adjust ranges to suit if you have more data.... then confirm the formula with CTRL+SHIFT+ENTER not just ENTER you will see { } brackets appear around the formula.

    Then copy down and across your table.
    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.

  4. #4
    Valued Forum Contributor Dunc3142's Avatar
    Join Date
    09-05-2007
    Location
    Franklin OH
    MS-Off Ver
    2000 and 2007 and 2010 @ Home & Teach 2010
    Posts
    351

    countifs

    Countifs works in 2007
    Attached Files Attached Files
    Yes it will. we just have to figure out how...
    If I have helped you, PLEASE click the * and add to my Rep.
    Also, if the problem is SOLVED please mark it as so.

  5. #5
    Registered User
    Join Date
    04-22-2008
    Posts
    4
    Quote Originally Posted by mrice
    You could add a new column to each sheet which concatenates the store and product.

    e.g. = A2 & "/" & B2

    You could then base your look-ups on this.
    Thanks, but that would be unproductive in mty case as I have enough junk data on that spreadsheet.

    Try this formula in B2:

    Quote Originally Posted by NBVC
    Code:
    =IF(ISNUMBER(MATCH(1,([raw_data.xls]Sheet1!$A$2:$A$11=$A2)*([raw_data.xls]Sheet1!$B$2:$B$11=B$1),0)),INDEX([raw_data.xls]Sheet1!$C$2:$C$11,MATCH(1,([raw_data.xls]Sheet1!$A$2:$A$11=$A2)*([raw_data.xls]Sheet1!$B$2:$B$11=B$1),0)),"")
    adjust ranges to suit if you have more data.... then confirm the formula with CTRL+SHIFT+ENTER not just ENTER you will see { } brackets appear around the formula.

    Then copy down and across your table.
    I know you're a MOD and all, but that is quite ingenious solution. Thank you very much. It works well on the test files now I just have to implement it in my live ridiculously huge spreadsheet.

    Really appreciate the help.

    George

  6. #6
    Registered User
    Join Date
    04-22-2008
    Posts
    4
    Quote Originally Posted by NBVC
    Try this formula in B2:

    Please Login or Register  to view this content.
    adjust ranges to suit if you have more data.... then confirm the formula with CTRL+SHIFT+ENTER not just ENTER you will see { } brackets appear around the formula.

    Then copy down and across your table.
    How to make the function replace all blanks I get from using the above function with "0" as I get #VALUE if any operation is performed with the blank cell?

    Thank you,

    George

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

    if there is no matching combination in columns A and B, you will get a blank... but not #VALUE! error....

    You will get that error if you didn't confirm the formula with the Ctrl+Shift+Enter keys....

    If you want 0 instead of blank returned when no matches found, simply replace the last "" with a 0, in the formula.... but you must reconfirm with the CSE keys each time you make a change.

  8. #8
    Registered User
    Join Date
    04-22-2008
    Posts
    4
    Quote Originally Posted by NBVC
    I'm not sure what you mean....

    if there is no matching combination in columns A and B, you will get a blank... but not #VALUE! error....

    You will get that error if you didn't confirm the formula with the Ctrl+Shift+Enter keys....

    If you want 0 instead of blank returned when no matches found, simply replace the last "" with a 0, in the formula.... but you must reconfirm with the CSE keys each time you make a change.
    Thank you, it worked I did try to change that myself but haven’t done the CSE combination so it wasn’t working. I need to perform operations with those cells and excel was giving me the #VALUE! error when it encountered a blank cell in the formula.

    Once again I'm grateful for your help.

    George

+ 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