0

NL Query Not Functioning with Excel IF statement

Hi All,

Not sure if this is possible but gettting confused trying to make it work. Any help would be most appreciated.

As per the formula below I'm essentially asking Jet to return information based on the result of another cell which is populated with a year. So if the year selected is either 2011 or 2012 then run the first query, if it's anything else run the other query. It has to be done this way as the info is in two separate tables.

When I have the NL query on it's own (for instance just looking at the 2011/2012 tables) it returns all the information I would expect but when I put the IF statement in and the NL query relating to the GL30000 table it only ever returns one line of data. That data relates to the selected period/year so that part seems to be working but rather than returning all the data I only get one line.

=IF(OR(Options!$D$8=2011,Options!$D$8=2012),'Detail Enquiry'!NL("Rows","GL20000","DEX_ROW_ID","TRXDATE",">="&StartDate,"TRXDATE","<="&EndDate,"Company=",Options!$D$10,"ACTINDX",'Detail Enquiry'!$A$4),NL("Rows","GL30000","DEX_ROW_ID","TRXDATE",">="&StartDate,"TRXDATE","<="&EndDate,"Company=",Options!$D$10,"ACTINDX",'Detail Enquiry'!$A$4))

Paul

2 comments

Please sign in to leave a comment.