Hi I have an Excel sheet with quite a number of data inside, and now I want to perform queries directly in the sheet using VBA. One query is to find the recurring users, so when I implemented it in MySQL I used the DATEDIFF function, so is it possible to do this in Excel? I've tried to embed the SQL statement into VBA, but it failed. Thank you!
My original SQL statement is like this:
select max(logtimestamp), min(logtimestamp), count(logtimestamp), username
from report
group by username
having datediff(max(logtimestamp),min(logtimestamp))>=14
order by count(logtimestamp) DESC;
And it works in MySQL.
EDIT:
I'm currently using ADODB in VBA to embed the SQL queries. Some simple queries have already been implemented, so I suppose my configuration is correct; the problem now is I don't know how to get this SQL query into VBA. It's now giving an error, and it might be related to the DATEDIF (different from DATEDIFF in SQL) function in Excel.