首页 \ 问答 \ Excel公式将月份增加一个,每周增加一个月(Excel formula to increase month by one and week in month by one)

Excel公式将月份增加一个,每周增加一个月(Excel formula to increase month by one and week in month by one)

我需要一个公式来将月中的一周增加一个,并将月份增加一个。

基本上我需要一个遵循这种模式的正在进行的周一列表:

Month 1 2016, Week 1 2016, Monday = 4th Jan 2016
Month 2 2016, Week 2 2016, Monday = 8th Feb 2016
Month 3 2016, Week 3 2016, Monday = 21st Mar 2016
Month 4 2016, Week 4 2016, Monday = 25th Apr 2016
Month 5 2016, Week 1 2016, Monday = 2nd May 2016
Month 6 2016, Week 2 2016, Monday = 13th Jun 2016

I need a formula to increase the week in month by one as well as increase the month by one.

Basically I need an ongoing list of Mondays that would follow this pattern:

Month 1 2016, Week 1 2016, Monday = 4th Jan 2016
Month 2 2016, Week 2 2016, Monday = 8th Feb 2016
Month 3 2016, Week 3 2016, Monday = 21st Mar 2016
Month 4 2016, Week 4 2016, Monday = 25th Apr 2016
Month 5 2016, Week 1 2016, Monday = 2nd May 2016
Month 6 2016, Week 2 2016, Monday = 13th Jun 2016

原文:https://stackoverflow.com/questions/37941322
更新时间:2024-01-03 20:01

最满意答案

对于您似乎想要实现的目标,我建议使用InStr函数。 InStr将搜索一个字符串,并返回它首次出现的位置。 如果在搜索的字符串中没有搜索到的字符串,则返回0

以下是它的使用方法:

InStr( [start], string, substring, [compare] )

一个工作示例c / o 网上技术

InStr(1, "Tech on the Net", "the")
'Result: 9'

InStr("Tech on the Net", "the")
'Result: 9'

InStr(10, "Tech on the Net", "t")
'Result: 15'

InStr("Tech on the Net", "z")
'Result: 0'

For what you seem to be trying to achieve, I'd suggest using the InStr function instead. InStr will search a string and will return the position where it first occurs. If the searched for string does not occur within the string being searched, 0 will be returned.

Here's how it's used:

InStr( [start], string, substring, [compare] )

A working example c/o Tech on the Net:

InStr(1, "Tech on the Net", "the")
'Result: 9'

InStr("Tech on the Net", "the")
'Result: 9'

InStr(10, "Tech on the Net", "t")
'Result: 15'

InStr("Tech on the Net", "z")
'Result: 0'

相关问答

更多
  • 对于您似乎想要实现的目标,我建议使用InStr函数。 InStr将搜索一个字符串,并返回它首次出现的位置。 如果在搜索的字符串中没有搜索到的字符串,则返回0 。 以下是它的使用方法: InStr( [start], string, substring, [compare] ) 一个工作示例c / o 网上技术 : InStr(1, "Tech on the Net", "the") 'Result: 9' InStr("Tech on the Net", "the") 'Result: 9' InSt ...
  • 改变这个: month = Worksheet(2).Cells(31, "J") 对此: month = Worksheet(2).Cells(31, "J").Value 和这个: Sheet1.Range("C" & num & ":C18") = 34 对此: For Each c in Worksheet(1).Range("C" & num & ":C18") c.Value = 34 Next c Change this: month = Worksheet(2).Cells(31 ...
  • 你能在变量中保存公式的一部分吗? 然后调用Formula数组中的变量? 要节省字符? 所以简单地分开等式。 例如: var1 = DAY(EOMONTH(R1C,0)) 然后在公式中替换它。 对多个易于用变量替换的部件执行此操作。 Can you save parts of the formula in variables? And then call the variables in the Formula array? To save on characters? So simply split th ...
  • 这对我有效... Sub Tester() Dim c As Range, cTot As Range, s As Series 'collect all values for "40" For Each c In Range("D1:D27").Cells If c.Offset(0, -1) = 40 Then If cTot Is Nothing Then Set cTot = c ...
  • 在您的代码中,Col为零。 列从索引1开始,试试这个: Col = 1 'Set column format to number Columns(col).NumberFormat = "0" In your code Col is zero. Columns start from the index 1, Try this: Col = 1 'Set column format to number Columns(col).NumberFormat = "0"
  • 你的最后一行, Debug.Print wksPivotData.Range(1, 1).Value将不会打印,因为你错过了Range() 。 我想你想要A1? 使用Range(1,1) ,您指的是不存在的范围。 如果你想做单元格A1,你需要 With wksPivotData myData = .Range(.Cells(1,1),.Cells(1,1)).Value End with 由于您使用的是多个工作表,因此我将使用上面的with语句。 编写相同内容的另一种方法是wksPivotData. ...
  • 我建议: Sub SUB_copyCtfColsToExtracted(sourceCol As Long, destCol As Long) sheetCTF.Range(sheetCTF.Cells(ctfHeadingRow, sourceCol), sheetCTF.Cells(ctfLastRow,sourceCol)).SpecialCells(xlCellTypeVisible).Copy _ Destination:=sheetEXTRACTED.Range(sheetEXTRACTED. ...
  • 设置名称的三个想法可能会失败: 您的工作簿中是否已有一张带有该名称的工作表? 尝试设置已在使用的名称将导致'1004' 也许您尝试设置的名称包含一些非法字符: : / \ * ? [ ] : / \ * ? [ ]是不允许的 也不允许使用空字符串或超过31个字符的字符串 Three ideas why setting the name might fail: Do you already have a sheet with that name in your workbook? Trying to set ...
  • 尝试下面的代码,它将从“Tabelle1”表格中的单元格“A4:L37”创建“ggg”命名范围。 然后,它将另一个Range MyNamedRange设置为指定的Range("ggg") - 这个步骤不是必需的,我只想使用Range变量。 最后,它选择MyNamedRange 。 码 Sub SelectRange() Dim sourceBook As Workbook Dim sourceSheet As Worksheet Dim sourceSheetSum ...
  • 您没有正确限定所有范围 - 您需要限定所有Range和Cells调用,以便它们指定相同的工作表: Dim senaste As Range Sheets("PA").Range(Sheets("PA").Cells(senaste.Row, (senaste.Column - 2)), Sheets("PA").Cells(senaste.Row, senaste.Column)).Copy Worksheets("GL").Range(Worksheets("GL").Cells(3, 1), Work ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。