用access和excel进行数据分析总结
#数据库操作(如表的合并,跨表查询,统计最大最小数值等)适合用access完成
#excel适合处理二维表,对单元格的简单计算,如下是典型的二维表
600600 | 600601 | 600602 | 600603 | 600604 | |
青岛啤酒 | 方正科技 | 广电电子 | ST兴业 | 二纺机 | |
2002-1-4 | 7.46 | 13.02 | 10.04 | 11.08 | 9.27 |
2002-1-7 | 7.31 | 12.9 | 9.92 | 11.1 | 8.85 |
2002-1-8 | 7.3 | 12.99 | 9.95 | 11.11 | 8.73 |
2002-1-9 | 7.19 | 12.92 | 10.04 | 11.44 | 8.25 |
2002-1-10 | 7.35 | 12.94 | 10.09 | 11.95 | 8.4 |
2002-1-11 | 7.28 | 12.66 | 9.77 | 11.68 | 8.04 |
2002-1-14 | 7.08 | 12.01 | 9.5 | 11.54 | 7.73 |
2002-1-15 | 6.99 | 12.02 | 8.95 | 11.34 | 7.67 |
2002-1-16 | 7.15 | 11.99 | 8.93 | 11.15 | 7.88 |
2002-1-17 | 6.91 | 11.58 | 8.4 | 10.04 | 7.19 |
2002-1-18 | 6.9 | 11.37 | 8.2 | 9.34 | 6.9 |
#一般思路: 对于原始的excel表,先利用access的SQL语句进行分组,排序,跨表合并
根据具体要求再利用excel的`公式或VBA完成其他复杂的功能
几点经验:
ss中要进行跨表查询,必须先建立"关系",可使用工具->关系菜单进行设置
2. 常见SQL语句
a)最大最小,排序处理
SELECT AFE_cast_Stkcd, AFE_, Min(AFE__DAYS_ELAPSED) AS RAW_DAYS_ELAPSED之最小值, Max(AFE__DAYS_ELAPSED) AS RAW_DAYS_ELAPSED之最大值
FROM AFE_statv2ACCURACY
GROUP BY AFE_cast_Stkcd, AFE_
ORDER BY AFE_cast_Stkcd, AFE_;
b)删除数据
DELETE *
FROM AFE_statv2无空项
WHERE AFE_statv2无空项cast_AFE最大值=AFE_statv2无空项cast_AFE最小值
c) 表的连接:
INNER JOIN保留公共数据,LEFT JOIN和RIGHT JOIN分别完整保留左,右表数据,必要时通过DISTINCT参数去除重复的记录
d)日期函数 Year等
3. excel VBA代码分析
Public Sub firstVBA()
Dim thisdate As Date
Dim wday As Integer
Dim rno As Integer
Dim stkcd As String
Dim ananm As String
Dim findStk1 As Range
Dim findStk2 As Range
Dim findStk3 As Range
Dim findStk6 As Range
Dim findStk7 As Range
Dim findStk8 As Range
Dim findStk9 As Range
Dim findStk10 As Range
Dim findIndex As Range
Dim findDate As Range
Dim TwoDayB As Integer
Dim TwoDayA As Integer
Dim OneDayB As Integer
Dim OneDayA As Integer
Dim FindCol As Integer
Dim CR_FIVE As Double
Dim CR_THREE As Double
Dim Revp As Double
Dim indexTwoDayB As Integer
Dim indexTwoDayA As Integer
Dim indexOneDayB As Integer
Dim indexOneDayA As Integer
Dim CR_Index_FIVE As Double
Dim CR_Index_THREE As Double
Sheet11是最终存放结果的表,Sheet1-3,6-10存放了各日各股票的价格,sheet5存放上证,深证指数
For rno = 2 To 6864
stkcd = e("A" & rno)e 查找股票代码
thisdate = e("E" & rno)e 查找日期
Set findStk1 = e("1:1")(stkcd)
Set findStk2 = e("1:1")(stkcd)
Set findStk3 = e("1:1")(stkcd)
Set findStk6 = e("1:1")(stkcd)
Set findStk7 = e("1:1")(stkcd)
Set findStk8 = e("1:1")(stkcd)
Set findStk9 = e("1:1")(stkcd)
Set findStk10 = e("1:1")(stkcd)
查找股票在哪张表中
If Not findStk1 Is Nothing Then
Set findStk = findStk1
Sheets("sz_stk1")ct
ElseIf Not findStk2 Is Nothing Then
Set findStk = findStk2
Sheets("sz_stk2")ct
ElseIf Not findStk3 Is Nothing Then
Set findStk = findStk3
Sheets("sz_stk34")ct
ElseIf Not findStk6 Is Nothing Then
Set findStk = findStk6
Sheets("sh_stk1")ct
ElseIf Not findStk7 Is Nothing Then
Set findStk = findStk7
Sheets("sh_stk2")ct
ElseIf Not findStk8 Is Nothing Then
Set findStk8 = findStk8
Sheets("sh_stk3")ct
ElseIf Not findStk9 Is Nothing Then
Set findStk = findStk9
Sheets("sh_stk4")ct
ElseIf Not findStk10 Is Nothing Then
Set findStk = findStk10
Sheets("sh_stk5")
-
护士长年终工作总结范文【合集】
总结是在一段时间内对学习和工作生活等表现加以总结和概括的一种书面材料,它可以有效锻炼我们的语言组织能力,因此我们需要回头归纳,写一份总结了。你所见过的总结应该是什么样的?下面是小编帮大家整理的护士长年终工作总结范文,仅供参考,大家一起来看看吧。护士长年...
-
行政个人工作总结[精]
总结是指对某一阶段的工作、学习或思想中的经验或情况进行分析研究,做出带有规律性结论的书面材料,它能够给人努力工作的动力,让我们好好写一份总结吧。总结怎么写才能发挥它的作用呢?以下是小编收集整理的行政个人工作总结,仅供参考,大家一起来看看吧。行政个人工作...
-
会计专业技术个人工作总结
总结是在一段时间内对学习和工作生活等表现加以总结和概括的一种书面材料,它可以明确下一步的工作方向,少走弯路,少犯错误,提高工作效益,为此我们要做好回顾,写好总结。总结怎么写才是正确的呢?下面是小编收集整理的会计专业技术个人工作总结,欢迎大家分享。会计专业技...
-
【必备】班组年终工作总结
总结是在某一特定时间段对学习和工作生活或其完成情况,包括取得的成绩、存在的问题及得到的经验和教训加以回顾和分析的书面材料,它能够使头脑更加清醒,目标更加明确,因此我们需要回头归纳,写一份总结了。那么总结有什么格式呢?以下是小编帮大家整理的班组年终工作总...
相关文章
- 数据分析、SPSS、EXCEL、PPT、水晶易表资料汇总
- 数据库access的优缺点总结
- ACCESS转SQL SERVER数据库的经验
- Eclipse使用EGit怎样clone远程仓库并导入Eclispe?
- clothes什么意思 clothes+clothing+dress等近义词用法辨析
- 英语面试问题:Which college classes did you like the
- ACCESS转SQLSERVER的数据库的建议
- ELECTRONICS ENGINEER(Experienced)电子简历模板
- system idle process是什么进程及作用
- PPT、EXCEL、SPSS、数据分析资料汇总