Search code examples
google-sheetsfiltergoogle-sheets-formulavlookupgoogle-query-language

vlookup several criteria and a range


Here's my table:

Exchange No. Name Tier 30d Volume (higher than) Maker Taker Specials
1 FTX 1 $0 0.0200% 0.0700%
FTX 2 $2,000,000 0.0150% 0.0600%
FTX 3 $5,000,000 0.0100% 0.0550%
FTX 4 $10,000,000 0.0050% 0.0500%
2 Binance Regular User $0 0.0120% 0.0500%
Binance VIP 1 $15,000,000 0.0120% 0.0500%
Binance VIP 2 $50,000,000 -0.0100% 0.0500%

I want to retrieve the correct fees in another table as follows:

Volume (past 30d): volume variable, ie $10,000 FTX Binance
Column # 2 3 4
IN: Maker correct fee correct fee
OUT-stop: Maker correct fee correct fee
OUT-profit: Maker correct fee correct fee
OUT-manually: Maker correct fee correct fee

B3 cell (second table) should take the fee in cell E2 (of the first table). Why? Cause:

  1. C1 (of second table) says "FTX" as per column B row 2:5 (of first table)
  2. Volume (in B1 of second table) is higher than D2 but lower than D3 (of first table)
  3. B3 (of second table) says "Maker" which is column F (of first table)

So I tried to do a vlookup but only my criteria No. 3 would work with vlookup.

Other criteria are a range higher than (No. 1) and two different columns as "index" (in vlookup formula) which are, by the way, the searched text... (No. 2)

Someone has an idea to take into account those special criteria in vlookup, or similar, please?


Solution

  • try:

    =INDEX(VLOOKUP(M2, QUERY({'Exchange Fees'!B2:B&":", 'Exchange Fees'!D2:D, 
     FILTER('Exchange Fees'!A2:G, 'Exchange Fees'!A1:G1=M3)}, 
     "select Col2,Col3 where Col1 = '"&N2&"'", ), 2, 1))
    

    enter image description here