+ Reply to Thread
Results 1 to 4 of 4

Search Function: Two field values against two column arrays, return a value

  1. #1
    Registered User
    Join Date
    05-23-2012
    Location
    A of US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Search Function: Two field values against two column arrays, return a value

    Hi All,

    I'm trying to write a function that takes a value in A1 and B1 from sheet 1, searches for it in sheet 2 A:A and B:B, and returns the value in sheet 2 column C that the value from A1 and B1 are found in sheet 1 A:B

    For example;

    Sheet 1: A1= Virtual, B1 = Microsoft, C1 = formula, D1 = 5

    Sheet 2: Virtual (A45) and Microsoft(B45) are found, formula returns the value in C45 = $500.

    I want the formula to then take the value ($500) and multiply it by D1(5) to produce a total value of $2500 in C1.

    I'm really stumped with this one, any help is appreciated!

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: Search Function: Two field values against two column arrays, return a value

    Try this

    =LOOKUP(2,1/(Sheet2!A$2:A$1000=A1)/(Sheet2!B$2:B$1000=B1),Sheet2!C$2:C$1000)*D1
    Audere est facere

  3. #3
    Registered User
    Join Date
    05-23-2012
    Location
    A of US
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Search Function: Two field values against two column arrays, return a value

    Quote Originally Posted by daddylonglegs View Post
    Try this

    =LOOKUP(2,1/(Sheet2!A$2:A$1000=A1)/(Sheet2!B$2:B$1000=B1),Sheet2!C$2:C$1000)*D1
    I inputted the below, T2 being A1, V2 being B1 and K2 being D1 but it seems to only like to grab some of the values? Also, it really takes a lot of processing power to compute in this workbook. Any suggestions?

    =LOOKUP(2,1/(qryAMSTandEDefTable!$A:$A=T2)/(qryAMSTandEDefTable!$B:$B=V2),(qryAMSTandEDefTable!$C:$C)*K2)

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Search Function: Two field values against two column arrays, return a value

    If you use whole column A:A, there are > million cells in a column, So excel calculating million cells. limit the range like A1:A1000 as DLL shows, or use a dynamic range.

    If value appear only one time use SUMIFS,

    =SUMIFS(qryAMSTandEDefTable!$C:$C,qryAMSTandEDefTable!$A:$A,T2,qryAMSTandEDefTable!$B:$B,V2)*K2
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ 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