Search code examples
if-statementgoogle-sheetsfiltergoogle-sheets-formulavlookup

Sheets/Excel " inside ""


Not sure if I correctly named (subject) this issue.

My code: ="Discount "$M4

It doesn't work because I do not close the brackets " after $M4. But when I write $M4" it reopens another input for text and needs to close the bracket with another ". So I tried """, doesn't work either. The third bracket reopens an input too...

Anyone knows how to close a text input with a bracket in this condition, without reopening one? Thanks.

Reproducible sample: I do not think you need the full tables as this is only a typo issue within the formula, if you feel you do please ask me in the comments and I'll it. Full formula:

=IF($R$1="No",INDEX(VLOOKUP($M$2, QUERY({'Exchange Fees'!$B$2:$B, 'Exchange Fees'!$D$2:$D, 
 FILTER('Exchange Fees'!$A$2:$G, 'Exchange Fees'!$A$1:$G$1=$M4)}, 
 "select Col2,Col3 where Col1 = '"&N$2&"'", ), 2, 1)),INDEX(VLOOKUP($R$1, QUERY({'Exchange Fees'!$B$2:$B, 'Exchange Fees'!$J$2:$J, 'Exchange Fees'!$L$2:$L, 
 FILTER('Exchange Fees'!$A$2:$L, 'Exchange Fees'!$A$1:$L$1="Discount "&$M4)}, 
 "select Col2,Col3,Col4 where Col1 = '"&N$2&"'", ), 2, 0)))")))))"""

Solution

  • try:

    'Exchange Fees'!$A$1:$L$1="Discount "&$M4
    

    update:

    =IF($R$1="No",INDEX(VLOOKUP($M$2, QUERY({'Exchange Fees'!$B$2:$B, 'Exchange Fees'!$D$2:$D, 
     FILTER('Exchange Fees'!$A$2:$G, 'Exchange Fees'!$A$1:$G$1=$M4)}, 
     "select Col2,Col3 where Col1 = '"&N$2&"'", ), 2, 1)),INDEX(VLOOKUP($R$1, QUERY({'Exchange Fees'!$B$2:$B, 'Exchange Fees'!$J$2:$J, 'Exchange Fees'!$L$2:$L, 
     FILTER('Exchange Fees'!$A$2:$L, 'Exchange Fees'!$A$1:$L$1="Discount "&$M4)}, 
     "select Col2,Col3,Col4 where Col1 = '"&N$2&"'", ), 3, 0)))
    

    enter image description here