下周四从随机日期如何获得? [英] How do I get next Thursday from a random date?

查看:114
本文介绍了下周四从随机日期如何获得?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做的是所以你有一个随机的日期列表,它永远不会是一样的,所以它必须是一个普遍的公式,但你得到任何日期,一年中的任何日期,然后每个星期四是开始一个新的一周。对于每个日期,您将日期设置为等于星期四,大于上一个日期,而小于星期四。

What I want to do is so you have a list of random dates, it will never be the same so it has to be a universal formula, but you get any date, any date of the year and then every Thursday is the Starting of a new week. For each date you set the date equal to the Thursday that it is greater than the previous and less than the Thursday.

自从我变得模糊以来,澄清的例子就是说截至2012年6月24日。6月24日大于2012年6月21日(即上周四),低于2012年6月28日,即下周四。这意味着它应该在2012年6月28日之前的列中生成价值。

Example to clarify since I am being vague, say you get June 24th, 2012. June 24th is greater than June 21st, 2012 (which is the previous Thursday) and it is less than June 28th, 2012, which is the next Thursday. This means it should generate the value June 28th, 2012 in the column next to it.

这是否有意义?根据您获得的任何日期值,您计算应生成哪个星期四日期?任何方式在excel中执行此操作?

Is that making any sense? Based on any date value you get, you calculate which Thursday date it should generate? Any way to do this in excel?

推荐答案

此公式将在A1之后的星期四给出

This formula will give you the Thursday following a date in A1

= A1 + 7-WEEKDAY(A1 + 2)

A1是星期四返回该日期,如果A1为星期四,则为A1 + 7,然后更改为此版本

If A1 is a Thursday it returns that date, if it should be A1+7 if A1 is Thursday then change to this version

= A1 + 8 -WEEKDAY(A1 + 3)

这篇关于下周四从随机日期如何获得?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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