I'm currently using the formula in this article to auto-populate a column of dates between to given dates:
=ArrayFormula(TO_DATE(row(indirect("A"&A2):indirect("A"&B2))))
How can I tweak the formula to give every second date? Column D in the article would then say:
01/04/2018
03/04/2018
05/04/2018
07/04/2018 ...and so on.
It seems like the formula skips a day if the start date is an odd date. Can this be corrected?
=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
MOD(ROW(INDIRECT("A1:A"&COUNTA(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2)))))), 2)))
=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
MOD(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))), 2)))
=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
ISODD(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))))))
=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
ISEVEN(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))))))
Related
I am very new at all of this, and I don't know if what I want to do is even possible, but I'm hoping someone can assist me with some formulas if it is.
I am trying to create a spreadsheet for my business's scheduling purposes. I have created a spreadsheet that lists my PO's, start date, end date, location, project hours, and total days.
I currently have a couple formulas on the sheet. When I enter the project hours in column e the formula =roundup(E2/24) inputs the expected total days of work into column f.
I have a starting date of 7/1/2022 entered in b2 then have a formula that looks at column c (end date) and adds the amount of days from column f (total days) to the end date. Each line there after copies the end date from the row above to the start date and then adds the total days from f to that to complete the next row.
What I would like to do is have the dates only reflect workdays (M-F) instead of returning all dates. Is this even possible?
Take a look at spreadsheet example, but it is pretty basic.
Thank you in advance for any help you can provide!
I understand that you want to add "Total days" to the "Start Date" to get the "End Date" excluding weekends, in this case Sundays and Saturdays.
Paste this formula in cell C2 "End Date" column.
=ArrayFormula(IF(E2:E="",,WORKDAY.INTL(B2:B,F2:F,"0000011",)))
Breakdown:
1 - ArrayFormula output's values into several rows and/or columns, and to make the formula dynamic.
2 - WORKDAY.INTL determines the date after a certain number of workdays, excluding certain number of weekends and holidays.
3 - [weekend] argument using string method of ones and zeros "0000011" to specify workdays and weekends, 0 workday, 1 weekends starting from Monday to Sunday.
here is the link to the spreadsheet, hope that answerd your question.
How can I have a column dynamically list every other date between a start date and an end date?
this is pretty much universal solution:
=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
MOD(ROW(INDIRECT("A1:A"&COUNTA(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2)))))), 2)))
for odd dates use:
=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
ISODD(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))))))
for even dates use:
=ARRAYFORMULA(FILTER(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))),
ISEVEN(TO_DATE(ROW(INDIRECT("A"&A2):INDIRECT("B"&B2))))))
I am building a really simple report in Crystal Reports and we need it to print the last day of the month, based off the month it is being printed in.
I would assume that Crystal has some way of doing this due to the "Special fields" like Print Date. Or am I going to have to write an if-then-else?
another way you can get the end of the month printed in your report is using this formula
dateserial(year(currentdate),month(currentdate)+1,1-1)
it will give you last day of current month, if you need a month before just subtract 1 in this part of the code month(currentdate)+1 and for a month after add 1 instead and so on and so forth
I used the formula discuss here: Crystal Report Date formula to make it the end of the month and that worked for me with some alteration. I changed it to suit my purposes as follows:
//{#EndOfMonth} // find the first day of the month, add a month to it, then subtract a day DateAdd("m", 1, DateTime( Year(CurrentDate), Month(CurrentDate), 1, 0,0,0 )) - 1 –
try this:
CDate(DateAdd("d", -1, DateSerial(Year(CurrentDate), Month(CurrentDate) + 1, 1)))
Essentially I may have any date and I want to get the proper quarter-end date for the previous quarter.
Three examples:
19/07/2013 -> 30/06/2013
30/06/2013 -> 31/03/2013
28/02/2013 -> 31/12/2012
In Excel VBA it seems using DateAdd to subtract a quarter just subtracts three months from the date, e.g. 19/07/2013 -> 19/04/2013. This is no good for me.
What do you think would be the best way of doing this?
Perhaps extracting the month part and then comparing it to a list of the
possible quarters?
Or maybe having some sort of null date
01/01/2000 and then adding the number of quarters the given date
shows as to this null date and then subtracting a day to get a
previous quarter-end position (although this might cause problems
when the date flips under a year to December 31)?
Please consider:
=IF(MOD(MONTH(A1),3)=0,EOMONTH(A1,-3),
IF(MOD(MONTH(A1),3)=1,EOMONTH(A1,-1),
EOMONTH(A1,-2)))
Edit: There is a better answer in the comments.
I want to calculate the number of days passed between past date and a current date. My past date is in the format dd/mm/yyyy format. I have used below mentioned formulas but giving the proper output.
=DAYS360(A2,TODAY())
=MINUS(D2,TODAY())
In the above formula A2 = 4/12/2012 (dd/mm/yyyy) and I am not sure whether TODAY returns in dd/mm/yyyy format or not. I have tried using 123 button on the tool bar, but no luck.
The following seemed to work well for me:
=DATEDIF(B2, Today(), "D")
DAYS360 does not calculate what you want, i.e. the number of days passed between the two dates – see the end of this post for details.
MINUS() should work fine, just not how you tried but the other way round:
=MINUS(TODAY(),D2)
You may also use simple subtraction (-):
=TODAY()-D2
I made an updated copy of #DrCord’s sample spreadsheet to illustrate this.
Are you SURE you want DAYS360? That is a specialized function used in the
financial sector to simplify calculations for bonds. It assumes a 360 day
year, with 12 months of 30 days each. If you really want actual days, you'll
lose 6 days each year.
[source]
Since this is the top Google answer for this, and it was way easier than I expected, here is the simple answer. Just subtract date1 from date2.
If this is your spreadsheet dates
A B
1 10/11/2017 12/1/2017
=(B1)-(A1)
results in 51, which is the number of days between a past date and a current date in Google spreadsheet
As long as it is a date format Google Sheets recognizes, you can directly subtract them and it will be correct.
To do it for a current date, just use the =TODAY() function.
=TODAY()-A1
While today works great, you can't use a date directly in the formula, you should referencing a cell that contains a date.
=(12/1/2017)-(10/1/2017) results in 0.0009915716411, not 61.
I used your idea, and found the difference and then just divided by 365 days. Worked a treat.
=MINUS(F2,TODAY())/365
Then I shifted my cell properties to not display decimals.
If you are using the two formulas at the same time, it will not work...
Here is a simple spreadsheet with it working:
https://docs.google.com/spreadsheet/ccc?key=0AiOy0YDBXjt4dDJSQWg1Qlp6TEw5SzNqZENGOWgwbGc
If you are still getting problems I would need to know what type of erroneous result you are getting.
Today() returns a numeric integer value: Returns the current computer system date. The value is updated when your document recalculates. TODAY is a function without arguments.
The following worked for me. Kindly note that TODAY() must NOT be the first argument in the function otherwise it will not work.
=DATEDIF( W2, TODAY(), "d")
Today() does return value in DATE format.
Select your "Days left field" and paste this formula in the field
=DAYS360(today(),C2)
Go to Format > Number > More formats >Custom number format and select the number with no decimal numbers.
I tested, it works, at least in new version of Sheets, March 2015.