Excel Micro用于创建财务年度 [英] Excel Micro for creating financial Year

查看:162
本文介绍了Excel Micro用于创建财务年度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友



我有一张excel表有两列第1列包含月份,第二列包含年份。

现在在第三栏我想要2013年1月的财政年度栏目是2012-2013财政年度,与2013年6月相同是2013-1014财政年度



请帮我在excel中创建micro或任何公式。

解决方案

这只是一个公式,如:

< pre lang =Javascript> IF MONTH(B1)< 6 然后C1 = TEXT(年份(B1) - 1 )+ - + TEXT(年(B1))
ELSE C1 = TEXT(年(B1))+ - + TEXT(年(B1)+ 1



注意:这不是一个确切的公式,但你应该明白这一点。


要做的步骤:

1)添加新模块

2)复制并粘贴下面的代码

 功能 FinancialYear(m 作为 整数,y 正如 整数作为 字符串 
Dim sRetVal 作为 字符串

如果 m> = 6 m< = 12 然后
sRetVal = y& - & y + 1
ElseIf m> = 1 m< = 5 然后
sRetVal = y - 1 & - & y
Else
sRetVal = 超出范围!
结束 如果

FinancialYear = sRetVal

结束 功能



3)在 C 栏中插入公式:

 = FinancialYear(A1; B1)



4)为每个单元执行3.步骤

5)完成!



示例结果:

 ABC 
1 2013 2012-2013
2 2013 2012-2013
3 2013 2012 -2013
4 2013 2012-2013
5 2013 2012-2013
6 2013 2013-2014
7 2013 2013-2014
8 2013 2013-2014
9 2013 2013-2014
10 2013 2013-2014
11 2013 2013-2014
12 2013 2013-2014
13 2013年超出范围!


Dear Friends

I have a excel sheet there are two column 1 contain month and second contain Year.
now in third column I want financial year column like January 2013 is the financial Year 2012-2013, same as June 2013 is financial year 2013-1014

please help me to create micro or any formula in excel .

解决方案

It's just a formula, something like:

IF MONTH(B1) < 6 THEN C1 = TEXT(YEAR(B1) - 1) + "-" + TEXT(YEAR(B1))
      ELSE C1 = TEXT(YEAR(B1)) + "-" + TEXT(YEAR(B1) + 1)


Note: this is not an exact formula but you should get the idea.


Steps to do:
1) add new module
2) copy and paste below code

Function FinancialYear(m As Integer, y As Integer) As String
Dim sRetVal As String

    If m >= 6 And m <= 12 Then
        sRetVal = y & "-" & y + 1
    ElseIf m >= 1 And m <= 5 Then
        sRetVal = y - 1 & "-" & y
    Else
        sRetVal = "Over the range!"
    End If
    
FinancialYear = sRetVal

End Function


3) Insert formula in C column:

=FinancialYear(A1;B1)


4) Do the 3. step for each cell
5) Done!

Example result:

A       B       C
1	2013	2012-2013
2	2013	2012-2013
3	2013	2012-2013
4	2013	2012-2013
5	2013	2012-2013
6	2013	2013-2014
7	2013	2013-2014
8	2013	2013-2014
9	2013	2013-2014
10	2013	2013-2014
11	2013	2013-2014
12	2013	2013-2014
13	2013	Over the range!


这篇关于Excel Micro用于创建财务年度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆