- 相關(guān)推薦
用access和excel進(jìn)行數(shù)據(jù)分析總結(jié)
#數(shù)據(jù)庫(kù)操作(如表的合并,跨表查詢,統(tǒng)計(jì)最大最小數(shù)值等)適合用access完成
#excel適合處理二維表,對(duì)單元格的簡(jiǎn)單計(jì)算,如下是典型的二維表
600600 | 600601 | 600602 | 600603 | 600604 | |
青島啤酒 | 方正科技 | 廣電電子 | ST興業(yè) | 二紡機(jī) | |
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 |
#一般思路: 對(duì)于原始的excel表,先利用access的SQL語(yǔ)句進(jìn)行分組,排序,跨表合并
根據(jù)具體要求再利用excel的公式或VBA完成其他復(fù)雜的功能
幾點(diǎn)經(jīng)驗(yàn):
1.access中要進(jìn)行跨表查詢,必須先建立"關(guān)系",可使用工具->關(guān)系菜單進(jìn)行設(shè)置
2. 常見SQL語(yǔ)句
a)最大最小,排序處理
SELECT AFE_statv2ACCURACY.forecast_Stkcd, AFE_statv2ACCURACY.YEAR, Min(AFE_statv2ACCURACY.RAW_DAYS_ELAPSED) AS RAW_DAYS_ELAPSED之最小值, Max(AFE_statv2ACCURACY.RAW_DAYS_ELAPSED) AS RAW_DAYS_ELAPSED之最大值
FROM AFE_statv2ACCURACY
GROUP BY AFE_statv2ACCURACY.forecast_Stkcd, AFE_statv2ACCURACY.YEAR
ORDER BY AFE_statv2ACCURACY.forecast_Stkcd, AFE_statv2ACCURACY.YEAR;
b)刪除數(shù)據(jù)
DELETE *
FROM AFE_statv2無(wú)空項(xiàng)
WHERE AFE_statv2無(wú)空項(xiàng).forecast_AFE最大值=AFE_statv2無(wú)空項(xiàng).forecast_AFE最小值
c) 表的連接:
INNER JOIN保留公共數(shù)據(jù),LEFT JOIN和RIGHT JOIN分別完整保留左,右表數(shù)據(jù),必要時(shí)通過(guò)DISTINCT參數(shù)去除重復(fù)的記錄
d)日期函數(shù) 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是最終存放結(jié)果的表,Sheet1-3,6-10存放了各日各股票的價(jià)格,sheet5存放上證,深證指數(shù)
For rno = 2 To 6864
stkcd = Sheet11.Range("A" & rno).Value 查找股票代碼
thisdate = Sheet11.Range("E" & rno).Value 查找日期
Set findStk1 = Sheet1.Range("1:1").Find(stkcd)
Set findStk2 = Sheet2.Range("1:1").Find(stkcd)
Set findStk3 = Sheet3.Range("1:1").Find(stkcd)
Set findStk6 = Sheet6.Range("1:1").Find(stkcd)
Set findStk7 = Sheet7.Range("1:1").Find(stkcd)
Set findStk8 = Sheet8.Range("1:1").Find(stkcd)
Set findStk9 = Sheet9.Range("1:1").Find(stkcd)
Set findStk10 = Sheet10.Range("1:1").Find(stkcd)
查找股票在哪張表中
If Not findStk1 Is Nothing Then
Set findStk = findStk1
Sheets("sz_stk1").Select
ElseIf Not findStk2 Is Nothing Then
Set findStk = findStk2
Sheets("sz_stk2").Select
ElseIf Not findStk3 Is Nothing Then
Set findStk = findStk3
Sheets("sz_stk34").Select
ElseIf Not findStk6 Is Nothing Then
Set findStk = findStk6
Sheets("sh_stk1").Select
ElseIf Not findStk7 Is Nothing Then
Set findStk = findStk7
Sheets("sh_stk2").Select
ElseIf Not findStk8 Is Nothing Then
Set findStk8 = findStk8
Sheets("sh_stk3").Select
ElseIf Not findStk9 Is Nothing Then
Set findStk = findStk9
Sheets("sh_stk4").Select
ElseIf Not findStk10 Is Nothing Then
Set findStk = findStk10
Sheets("sh_stk5").Sele
【用access和excel進(jìn)行數(shù)據(jù)分析總結(jié)】相關(guān)文章:
數(shù)據(jù)庫(kù)access的優(yōu)缺點(diǎn)總結(jié)04-21
Access數(shù)據(jù)庫(kù)實(shí)驗(yàn)報(bào)告03-01
數(shù)據(jù)分析個(gè)人總結(jié)01-09
數(shù)據(jù)分析報(bào)告07-28
大數(shù)據(jù)分析07-20
銷售數(shù)據(jù)的分析方法07-25
大數(shù)據(jù)分析07-25
數(shù)據(jù)分析個(gè)人總結(jié)3篇01-09
多維數(shù)據(jù)分析方法04-07