Using Countifs in Access 2016 Query - ms-access

I am using the following formula in Excel to conditionally rank the ballNumber column:
=COUNTIFS(BallByBallTable[matchId],A2,BallByBallTable[batsman],E2,BallByBallTable[ballNumber],"<"&C2)+1
It works ok but the table (which is imported from Access) is now quite large and causes Excel to run very slowly.
Is it possible to convert this formula so I can use it in an Access query?
Thanks

Related

Excel VBA using SQL Datediff

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.

MySQL Query or Excel 2010 - Which is the better way of arranging data for reports?

Info: Server version: 5.1.39 - MySQL / phpMyAdmin
Php: 5.4
Server: Apache
Code is run via: Server SQL Query (copy & paste in the phpMyAdmin) or in MySQL Workbench or using a custom shopping cart manager.
Exports to: Excel 2010 (.csv then to .xlsx for sales reports)
Hi there,
This is more a personal question, rather than a technical, however the answer should have a technical component.
Which is better? Run a full query (with calculations) in MySQL, export to Excel and work on that data OR Run a basic query and then run the calculations in Excel?
The scenario:
My sales reports are in MySQL from my online store, each month I export the data that I need and create reports in Excel with additional information. (Info not in the store).
My query has calculations, both for profit/loss & dates. I can do this in excel as well.
I am not an expert in either field, barely scraping by with help from people such as the community here and other sites, however I'd like to read some feedback from those that work with both.
I currently use things like (in addition to column calculations):
DATE_FORMAT(T5.date_purchased, '%Y-%m-%b') As OrdMonth,
DATE_FORMAT(T5.date_purchased + INTERVAL 1 MONTH, '%Y-%m-%b') As PayMonth,
concat(date_format(T5.date_purchased + INTERVAL 1 MONTH, '%y%m'), '-', T4.manufacturers_id) As RepID,
DATE_FORMAT(T5.date_purchased + INTERVAL 1 MONTH,'%y%m') As BatchID,
Which I can do in Excel with similar formulas.
So, is it better to have the report generate from the server as I want it in Excel, or just get the barest of info & run the calculations after?
Thank you in advance for your knowledge & input.
If the target user is any typical viewer of a web page, then use PHP+SQL.
If the target user is you, then get the data out as quickly as you can, then massage it with Excel.
Excel is more flexible, and functions + VBA will take you farther and faster than SQL.
In order to go more in depth with the answer I need more details.
EDIT
Here is the solution that I use very often: it is not professional, but when it's for personal use it's the fastest way:
Open both the csv file with the data to analyze and the Excel file with a VBA macro called CreateReport.xmls
Run the macro
Here is the description of the steps executed by the macro:
Scan all the open workbooks looking for the csv file (recognizing it for example by some header that is always there)
Add columns with formulas
For each report:
Duplicate the sheet
Delete the rows or columns that you don't need
Apply the formatting
If you don't know VBA there are many resources out there to get started. You can come back here when you have more specific questions.

how to consider 2 row as column names for importing excels to sql server using SSIS

I am importing Excel data to DB using SSIS package.
The problem is i want to consider second Row i.e A2:Z2 as column name.
I don't want to take A1:Z1 into consideration.
How can i achieve it.
My researched Link 1 Link 2
I have a sample excel file with the data like
In excel source use SQL Command for Data access mode and write the query to skip the initial row
SELECT * FROM [Sheet1$A2:B]
--In your case it will be [Sheet1$A2:Z]
and in the excel connection manager select the option First Rows as Column name
When i try to preview it ,i get the data from the 2nd row onwards

SSIS - Export data from Excel to sql table

When i am trying to export data from excel to sql table using ssis,the all rows are inserted . But,when i am inserting a data of length greater than 255 to excel it's giving truncation error. In output column i altered it to 500. in External column input i can't alter it. In my excel sheet there is 2808 rows..but when this error is generating its only inserting 1632 rows and whole other rows are getting truncated....
If any one knows about this,please help me..I am really stuck on this....
Thanks..
Try sorting your data by length eg longest first.
Excel import/export is very buggy in SSIS.
Sometimes the only option is to write VBA script and run it from excel itself

Excel SSIS and SQL server

I want to develop an automation in SSIS.
Problem statement :
I have an excel sheet which has a single column.
Based on the values in that column (will be included as a search parameter in the SQL query) I need to fetch 2 or more columns from SQL server database
The results are to be stored in the same Excel sheet against the data obtained for that particular column.
I already have an excel macro for the same. But, now I want to develop a package for the same.
Please guide me through the necessary steps.
I will also keep trying to obtain the solution
Create an Excel Source and link it to your file
use a lookup component to perform a SQL select to obtain the missing data
Create an Excel destination to save your target data