vlookup several criteria and a range - google-sheets

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:
C1 (of second table) says "FTX" as per column B row 2:5 (of first
table)
Volume (in B1 of second table) is higher than D2 but lower than D3 (of first
table)
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?

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))

Related

In Google Sheets, I want to get all data from a specific column where the first column matches my SKU. There are multiple rows with that SKU

I have data that looks like this:
sku
price
level
ab1
1.01
1
ab2
2.06
1
ab2
1.45
25
ab3
2.00
1
ab3
1.40
10
ab3
0.89
25
ac2
0.74
1
ac2
0.50
100
As you can see, I have products that have quantity discounts in one sheet. I need to get these levels and prices out of this sheet and into another sheet.
I need to get all prices and levels for all skus, not just the first match. So if my lookup is for sku AB3 I would expect to find 2.00 / 1, 1.40 / 10 and 0.89 / 25
I have not got an extensive Google Sheets knowledge so I am afraid I have hit a brick wall in what to search for.
What do I need to do in order to get this data from sheet a into sheet b.
I have not yet decided how this data is going to look in sheet b, so I don't know if I want the price and level to go into the same cell like "1.01 per 25" or in separate cells.
You can use FILTER() function.
=FILTER(B2:C,A2:A=F1)
Or QUERY() function like-
=QUERY(A2:C,"select B, C where A='" & F1 & "'")

manipulate data from multiple rows in a sheet, combine the new totals together, and post to a different sheet

I have two google sheets. One is more of a summary and the other one tracks all of the data. I need to get the price from the row on the 2nd page that is marked as entry, with a corresponding trade id to the first page, and then, if it was a long trade(Determined by the Long/Short(L/S) column on page 1, subtract the entry price from each exit price and then add those values together. If short trade it would be each entry price minus the exit entry price. Most trades will have 1 entry and 2 exits.
Basic example: Buy 3 contracts long at $10. Exit at $15 for 2 contracts and $20 for 1 contract.
So it will be (exit1 - entry) + (exit1 - entry) + (exit2 - entry). This
will give me the total points for each section of the trade. That data
then needs to get displayed on the overview tab
Example google sheet: https://docs.google.com/spreadsheets/d/1Y8QHrARyYjJKfOwq0g3waDfkVyWbWc2uSIzBiqsIal0/edit?usp=sharing
Edit: adjusted match to properly represent the outcome.
Try this one.
Formula:
=sum(query('Trades Taken'!A:D, "select D where A = "&A2&" and B = 'Exit'")) - (rows(filter('Trades Taken'!A:D, 'Trades Taken'!A:A = A2, 'Trades Taken'!B:B = "Exit")) * filter('Trades Taken'!D:D, 'Trades Taken'!A:A = A2, 'Trades Taken'!B:B = "Entry"))
I have simplified the formula so it would be easier to interpret.
Output:

Using COUNTIF's & Total Sums In Google Sheets To Work Out A Financial Total Sum

I'm looking for a specific Google Sheets formula. I believe it's using COUNTIFS & SUMIF, but I can't work out how to do it, any help would be really appreciated.
So, my "C" column has a number of letter combinations in each cell... These are "FHG" "CS" "MO" and afew others. They are a reference to specific market trading strategies and I'm using this sheet to track every trade I make. So C3 may contain "FHG" C4, "MO" C5, "FHG", C6 "FHG" etc.
In the "I" column, there is a 'profit and loss' column which states how much was generated/lost for that particular row... These are formatted to currency.
At the top of my sheet, I have a summary list of each set of letters and I'm using a COUNTIF statement to work out the total number (instance count) of each particular letter combo and from there, I can work out strike rates, percentages etc.
The thing I can't work out is, 'is there a way to count/sum the relative numbers in the "I" column based on a specific letter combo?' For example, let's say running down today's trades, FHG appears on C3, C6, C8, C12, C16 etc. can I collect and sum the numbers (to create a total) from the corresponding P&L column, I3, I6, I8, I12, I16 etc?
My main aim is to have the following at the top in my "Summary Section":
'Letter Combo/Name Of Trading Technique' - 'Number Of Trades' (Using COUNTIFS down C Column) - 'Total % Win Rate' (Number Of Winners/Number Of Total Trades For Said Strategy - This is done using a separate column of Y or N for winners or losers) - The one that I need help with is - "Total Sum Of Money Generated For Each Particular Letter Combo (Trading Strategy)"...... I've worked out how to do the first 3 columns, but I can't work out how to pick the numbers out from the P&L column (I) based on what kind of trade (letter combo) exists in the corresponding (C) column.
If every trade made the same about of money, this would probably be an easy calculation, but because each return is different, this is proving challenging.
Thanks for any insights :)
try:
=QUERY(A:I; "select C,sum(I) where A is not null group by C label sum(I)''")
or just for SB:
=QUERY(A:I; "select C,sum(I) where C = 'SB' group by C label sum(I)''")
if you want a count too:
=QUERY(A:I; "select C,count(C),sum(I) where A is not null group by C")

Summing values and averaging values while removing duplicates in Excel or Google Sheets

I have a google sheet that I use to track the different occasion I stock my items for small retail reselling, since the things I buy can have different price on different occasion (discounts, cashback, etc), I need to average the cost of a unique item while also adding the total stocks I have. removing the duplicates.
A B C D E F G
ITEMS STOCKS PRICE PER PCS SUBTOTAL DISCOUNT TOTAL FINALPRICE/PCS
ITEM1 3 $2 $6 10% $5.4 $1.8
ITEM2 2 $3
ITEM4 2 $1.5
ITEM1 2 $1.8 $3.6 10% $3.24 $1.62
So right now, I can put the following formula to column J
to already remove the duplicates and add the stocks of the duplicates.
={unique(A2:A5),ArrayFormula(sumif(A2:A5,unique(A2:A5),B2:B5))}
result as below,
J K
ITEMS STOCKS
ITEM1 5
ITEM2 2
ITEM4 2
But I would also like to average the price per pcs for unique items on column L. Any help is appreciated!
I tried
={unique(A2:A5),ArrayFormula(sumif(A2:A5,unique(A2:A5),B2:B5)), ArrayFormula(averageif(A2:A5,unique(A2:A5),G2:G5))}
This is the error code
Error
Function ARRAY_ROW parameter 3 has mismatched row size. Expected: 24. Actual: 1.
use QUERY instead like:
=QUERY(A2:G,
"select A,sum(B),avg(G)
where A is not null
group by A
label sum(B)'',avg(G)''", 0)

Google Sheets - Percentage Calculation

Would do this manually but it would be best done auto.
Column A is product name.
Column B is Product Price.
Column C should be Column B entry plus a percentage (in this case VAT which is currently 21%
How would I achieve this?
If B2 has price in it then in C2 you can write =B2*(1.21) to make it
21% higher than B2.
– Amit Singh

Resources