楼主: 岁月还好
2133 5

[问答] excel 挑选数据问题 [推广有奖]

  • 1关注
  • 0粉丝

已卖:3份资源

本科生

40%

还不是VIP/贵宾

-

威望
0
论坛币
79 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
683 点
帖子
48
精华
0
在线时间
62 小时
注册时间
2012-6-28
最后登录
2013-5-29

楼主
岁月还好 发表于 2012-10-22 09:57:43 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
股票的样本期是03年1月到2011年12月一共9年108个月的A股所有的股票数据的月收益,现在我要做3年期的滚动回归,要求数据不能有空缺值,也就是要求所有的股票都有108个月的数据,没有的要剔除。现在股票数据太多,请问怎么用count或者countif函数或是别的函数挑选这些月份不足的股票呢,谢谢各位了!!!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:EXCEL exce xcel cel COUNTIF excel

回帖推荐

coral033 发表于3楼  查看完整内容

Table of contents Missing numbers (array formula) Missing numbers (vba) Missing numbers (array formula) Question: I want to find missing numbers in a range? Answer: C1 and C2 contain the range boundaries. Array Formula in B5 =SMALL(IF(ISERROR(MATCH($C$1+ROW(OFFSET($A$1, 0, 0, $C$2-$C$1+1))-1, $A$2:$A$6, 0)), $C$1+ROW(OFFSET($A$1, 0, 0, $C$2-$C$1+1))-1), ROW(A1)) How to create an arra ...

沙发
coral033 在职认证  发表于 2012-10-23 11:00:50
http://www.get-digital-help.com/ ... sing-excel-formula/
Identify missing values in a column using excel formula
Out of difficulties, makes miracles.

藤椅
coral033 在职认证  发表于 2012-10-23 11:02:01
Table of contents

Missing numbers (array formula)
Missing numbers (vba)
Missing numbers (array formula)

Question: I want to find missing numbers in a range?
Answer: C1 and C2 contain the range boundaries.

Array Formula in B5
=SMALL(IF(ISERROR(MATCH($C$1+ROW(OFFSET($A$1, 0, 0, $C$2-$C$1+1))-1, $A$2:$A$6, 0)), $C$1+ROW(OFFSET($A$1, 0, 0, $C$2-$C$1+1))-1), ROW(A1))
How to create an array formula
Select cell B5
Copy / Paste array formula
Press and hold Ctrl + Shift
Press Enter
Release all keys
How to copy array formula
Copy cell B5
Select cell B6:B11
Paste
Download excel sample file for this tutorial.
missing-values-in-a-column.xlsx
(Excel 2007 Workbook *.xlsx)
Functions in this article:
MATCH(lookup_value;lookup_array; [match_type]
Returns the relative position of an item in an array that matches a specified value
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE
ROW(reference) returns the rownumber of a reference
SMALL(array,k) Returns the k-th smallest row number in this data set.
Missing numbers (vba)

The macro demonstrated here let′s you select a cell range (values must be in a single column), start and end number.

A new sheet is created, values are sorted in the first column. The second column (B) contains all missing values.

VBA

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Sub Missingvalues()
Dim rng As Range
Dim rng1 As Range
Dim StartV As Single, EndV As Single, i As Single, j As Single
Dim k() As Single
Dim WS As Worksheet
ReDim k(0)
On Error Resume Next
Set rng = Application.InputBox(Prompt:="Select a range:", _
Title:="Extract missin values", _
Default:=Selection.Address, Type:=8)
StartV = InputBox("Start value:")
EndV = InputBox("End value:")
On Error GoTo 0
Set WS = Sheets.Add
WS.Range("A1:A" & rng.Rows.CountLarge).Value = rng.Value
With WS.Sort
    .SortFields.Add Key:=WS.Range("A1"), _
    SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    .SetRange Range("A1:A" & rng.Rows.CountLarge)
    .Header = xlNo
    .MatchCase = False
    .Orientation = xlTopToBottom
    .SortMethod = xlPinYin
    .Apply
End With
Set rng1 = WS.Range("A1:A" & rng.Rows.CountLarge)
For i = StartV To EndV
    On Error Resume Next
    j = Application.Match(i, rng1)
    If Err = 0 Then
        If rng1(j, 1) <> i Then
            k(UBound(k)) = i
            ReDim Preserve k(UBound(k) + 1)
        End If
    Else
        k(UBound(k)) = i
        ReDim Preserve k(UBound(k) + 1)
    End If
    On Error GoTo 0
Next i
ReDim Preserve k(UBound(k) - 1)
WS.Range("B1") = "Missing values"
WS.Range("B2:B" & UBound(k) + 1) = Application.Transpose(k)
End Sub
已有 1 人评分经验 论坛币 热心指数 收起 理由
客初 + 20 + 20 + 2 热心帮助其他会员

总评分: 经验 + 20  论坛币 + 20  热心指数 + 2   查看全部评分

Out of difficulties, makes miracles.

板凳
coral033 在职认证  发表于 2012-10-23 11:04:42
如果做回归分析的话,在对应变量有缺失值时,系统默认是删除整条对应记录。
Out of difficulties, makes miracles.

报纸
coral033 在职认证  发表于 2012-10-23 11:18:23
这里有个例子,用IF函数,share一下。
http://ms-office.wonderhowto.com ... if-function-368008/
Out of difficulties, makes miracles.

地板
241king 发表于 2014-12-6 13:34:18
[tongue][tongue]谢谢!谢谢分享

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-20 14:34