设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

12下一页
返回列表 发新帖
查看: 5667|回复: 14
打印 上一主题 下一主题

星期几的函数如何实现

[复制链接]
跳转到指定楼层
1#
发表于 2008-11-10 07:27:27 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如下表,给年月日在另一列中配相应的星期几
非常谢谢!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2008-11-10 08:47:30 | 只看该作者
你给出的时间不是正确的日期格式.
3#
 楼主| 发表于 2008-11-10 09:48:28 | 只看该作者
版主,您好,从软件中导出来就如此,我用设置单元格式又改不动,请您帮忙改一下,非常谢谢版主!
4#
 楼主| 发表于 2008-11-10 09:57:55 | 只看该作者
版主,您好,从软件中导出来就如此,我用替换改了,重新传上,望告知星期的方法,非常谢谢版主!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
5#
发表于 2008-11-10 15:31:36 | 只看该作者
FYI.

WEEKDAY

See Also

Returns the day of the week corresponding to a date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday), by default.

Syntax

WEEKDAY(serial_number,return_type)

Serial_number    is a sequential number that represents the date of the day you are trying to find. Dates should be entered by using the DATE function, or as results of other formulas or functions. For example, use DATE(2008,5,23) for the 23rd day of May, 2008. Problems can occur if dates are entered as text.

Return_type    is a number that determines the type of return value.

Return_type Number returned
1 or omitted Numbers 1 (Sunday) through 7 (Saturday). Behaves like previous versions of Microsoft Excel.
2 Numbers 1 (Monday) through 7 (Sunday).
3 Numbers 0 (Monday) through 6 (Sunday).

Remark
Microsoft Excel stores dates as sequential serial numbers so they can be used in calculations. By default, January 1, 1900 is serial number 1, and January 1, 2008 is serial number 39448 because it is 39,448 days after January 1, 1900. Microsoft Excel for the Macintosh uses a different date system as its default.

Example

The example may be easier to understand if you copy it to a blank worksheet.

How?

Create a blank workbook or worksheet.
Select the example in the Help topic. Do not select the row or column headers.


Selecting an example from Help

Press CTRL+C.
In the worksheet, select cell A1, and press CTRL+V.
To switch between viewing the results and viewing the formulas that return the results, press CTRL+` (grave accent), or on the Tools menu, point to Formula Auditing, and then click Formula Auditing Mode.
   
1
2
A
Data
2/14/2008
Formula Description (Result)
=WEEKDAY(A2) Day of the week, with numbers 1 (Sunday) through 7 (Saturday) (5)
=WEEKDAY(A2,2) Day of the week, with numbers 1 (Monday) through 7 (Sunday) (4)
=WEEKDAY(A2,3) Day of the week, with numbers 0 (Monday) through 6 (Sunday) (3)


Note  2/14/2008 is a Thursday.
6#
发表于 2008-11-10 16:54:07 | 只看该作者
你的日期格式是文本的,是个麻烦的事情,所以先用DATEVALUE函数转成换,再用WEEKDAY函数

实例:

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x

点击这里给我发消息

7#
发表于 2008-11-10 17:26:05 | 只看该作者
A列所有的数据前面多了个空格。
编辑》替换:
查找为:空格
替换为:什么都不输入
全部替换
然后用weekday(a6,2)下拉就可以了。
其实不用函数,直接在格式》单元格》数字里设置日期里的星期格式也可以。
8#
发表于 2008-11-10 18:28:08 | 只看该作者
原帖由 pureshadow 于 2008-11-10 17:26 发表
A列所有的数据前面多了个空格。
编辑》替换:
查找为:空格
替换为:什么都不输入
全部替换
然后用weekday(a6,2)下拉就可以了。
其实不用函数,直接在格式》单元格》数字里设置日期里的星期格式也可以。


如果不是文本字符用格式就可以了,但他导下来的数据日期为文本格式.

点击这里给我发消息

9#
发表于 2008-11-10 18:34:04 | 只看该作者
江版说得没错,所以要先替换掉空格。
10#
 楼主| 发表于 2008-11-10 22:00:55 | 只看该作者
感谢江版!感谢小妖!非常感谢!终于弄明白了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-5-3 21:06 , Processed in 0.113371 second(s), 34 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表