I have an sql statment inside of excel cell:
="select BLAH from BLAH where BLAH"
I am looking to put this sql statement inside of an if statment based on blank cells.
I try and do the following:
=IF(AND(ISBLANK(G7),ISBLANK(H7)), "="select BLAH1 from BLAH1 where BLAH1"", ="select BLAH2 from BLAH2 where BLAH2"")
I get errors when trying to do this because of nested quotes. Is it possible to put sql statments in an if statement outside of VBA?
Or even more general, is it possible to put functions as the return value of an if statement?
You don’t need the equals inside the
IFstatement. You already have it at the beginning of the line, the equals is only there to tell Excel that it’s a formula.