I need to write the formula to check the last working day of the month in excel.
Data look like this:
| Date |
| 2018/10/22 |
| 2018/10/31 |
The output should be:
| Date | Check |
| 2018/10/22 | o |
| 2018/10/31 | x |
Working day: from Mon to Friday, No holidays.
The 'last working day of the month' is a bit ambiguous given different holiday structures and the fact that not everyone works Monday to Friday. However, if a list of local holidays is provided in Z2:Z13, the WORKDAY.INTL function should be able to return the last workday of any month with a variety of work and holiday schedules.
=WORKDAY.INTL(EOMONTH(A2, 0)+1, -1, "0000011", Z$2:Z$13)
For the purpose of demonstration, I've added the weekday to the date format with a custom number format of ddd, yyyy/mm/dd_).
In the following sample image, note that the fictional holiday of Wed, 2018/01/31 pushed the 'last workday of the month' to Tue, 2018/01/30 and March's last day is Fri, 2018/03/30 since Saturday is considered a non-workday.
Related
https://www.jooq.org/doc/latest/manual/sql-building/column-expressions/datetime-functions/quarter-function/
This works fine for a normal quarter. what if I want to make it work for a fiscal quarter with a custom month?
FISCAL QUARTER MEANS.. instead of January as the starting month of the first quarter it can be any month.
If I consider August as the first month of my fiscal year.
My fiscal quarter look likes these :
Aug-Sep-Oct'2021 => 1st fiscal quarter '2021
Nov-Dec-Jan'2022 => 2nd fiscal quarter '2021
Feb-March-April'2022 => 3rd fiscal quarter '2021
May-June-July'2022 => 4th fiscal quarter '2021
If your fiscal quarters are strictly month based, why not do some arithmetic on the DSL.month(date), such as:
trunc(month(DATE_COLUMN).add(4).div(3)).mod(4).add(1)
An example in PostgreSQL:
select d, trunc((extract(month from d) + 4) / 3) % 4 + 1
from (
select (date '2000-01-01' + i * interval '1 month')::date
from generate_series(0, 11) as t(i)
) t(d)
Resulting in
|d |?column?|
|----------|--------|
|2000-01-01|2 |
|2000-02-01|3 |
|2000-03-01|3 |
|2000-04-01|3 |
|2000-05-01|4 |
|2000-06-01|4 |
|2000-07-01|4 |
|2000-08-01|1 |
|2000-09-01|1 |
|2000-10-01|1 |
|2000-11-01|2 |
|2000-12-01|2 |
dbfiddle here. Now, depending on whatever the first month of your fiscal year is, adapt the formula accordingly, by toggling the add(4) value.
How to add DUE DATE, counting start from table INVOICE DATE in Microsoft Office Excel ?
I don't know how to using this formula, but I got some hints :
if an invoices start date between 2-15 per months, due date automatically filled date 15 next month
Examples:
INVOICE DATE | DUE DATE format (D-M-Y)---------------------------------
11/08/2019 | 15/09/2019
15/08/2019 | 15/09/2019
02/09/2019 | 15/10/2019
if an invoices start date between 16-31 per months and date 1st next month, due date automatically filled date 1 every 2 next months
Examples:
INVOICE DATE | DUE DATE format (D-M-Y)---------------------------------
21/08/2019 | 01/10/2019
16/08/2019 | 01/10/2019
01/09/2019 | 01/10/2019
01/12/2019 | 01/01/2020
30/12/2019 | 01/02/2020
what should I do, prefer on table A or table B ? for easy to use ?
fixed image here
or you can download it here -> Google Drive(Fixed)
Try this one (the invoice date is in cell A1 here):
=IF(AND(DAY(A1)<16,DAY(A1)>1),DATE(YEAR(EOMONTH(A1,1)),MONTH(EOMONTH(A1,1)),15),DATE(YEAR(EOMONTH(A1,2)),MONTH(EOMONTH(A1,2)),1))
Try below formula. You have to format the resulting cell as date format.
=IF(AND(DAY(A2)>=2,DAY(A2)<=15),DATE(YEAR(A2),MONTH(A2+1),15),DATE(YEAR(A2),MONTH(A2)+2,1))
I am currently trying to use a excel formula to estimate how long a record has been open based off of two fields and today's date. I however want to have the formula to be blank if the "Closed Date" is not populated. I haven't had success with getting this result.
Example in Excel:
| | A - Open Date | B - Closed Date |
|---|-----------------|-----------------|
| 1 | 02 January 2019 | 04 January 2019 |
| 2 | 02 January 2019 | |
| 3 | | |
I currently am using the following formula for each pertaining row;
=IF(B1>0, B1-A1,TODAY()-A1)
=IF(B2>0, B2-A2,TODAY()-A2)
=IF(B3>0, B3-A3,TODAY()-A3)
For the first row I will get 2 which is correct. The second row will also have 2 but will go up each day which is also correct. The third row will have a large number like 43559 which is due to there being no open date in A3. Any assistance would be appreciated. Thank you.
I'll add this as an answer as I think you mean:
If "Open Date" is not populated show a blank
If "Closed Date" is not populated use todays date.
=IF(A1="","",IF(B1="",TODAY(),B1)-A1)
Maybe: =IF(B1="","",B1-A1) ??
I have a home rental business, I wish to calculate the occupancy rate.
For that, I need to calculate the number of nights in a specific month between 2 dates (check-in and check-out).
Here's an example:
A B C D E F
1 | IN | OUT | NIGHTS | 01/01/18 | 01/02/18 |...
------------------------------------------------------------
2 | 15/01/18 | 25/01/18 | 10 | 10 | 0 |...
------------------------------------------------------------
3 | 28/01/18 | 04/02/18 | 7 | 3 | 3 |...
Here are the formulas for:
C3 = B3-A3
D3 = MAX(0; MIN(EOMONTH(D$1;0); $B3) - MAX(D$1; $A3))
I think I'm not too far but the formula is still incorrect.
As you can see, D2 is correct, but D3 is wrong.
This is the tricky part, when the stays overlaps on 2 months, Jan and Feb in thisi case.
D3 should show 4 nights and not 3.
Anyone can help please? Thanks in advance!
PS: sorry for the formatting but I am not able to add a screenshot..
I was thinking that you just add a day to the end of the month unconditionally - I need to try this with one or two test cases though.
MAX(0; MIN(EOMONTH(D$1;0)+1; $B3) - MAX(D$1; $A3))
Just to spell out the four possible scenarios - given start date d1/m1/y1 (A3), end date d2/m2/y2 (B3) ,first day of current month 01/mm/yy (D1) and last day of current month dd/mm/yy (last day of month in D1)
(1) d1/m1/y1>=01/mm/yy and d2/m2/y2 <= dd/mm/yy -> d2/m2/y2 - d1/m1/y1
(Both days in current month - all nights between the two dates)
(2) d1/m1/y1 < 01/mm/yy and d2/m2/y2 <= dd/mm/yy -> d2/m2/y2 - 01/mm/yy
(Start before current month, end in current month - all nights from 1st of month up to end date)
(3) d1/m1/y1 >= 01/mm/yy and d2/m2/y2 > dd/mm/yy -> 01/(mm+1)/yy - d1/m1/y1
(Start in current month, end after current month - all nights from start date up to 1st of following month)
(4) d1/m1/y1 < 01/mm/yy and d2/m2/y2 > dd/mm/yy -> 01/(mm+1)/yy - 01/mm/yy
(Start before current month, end after current month - all nights in month).
In other words, it counts each night following a day in the range, but not the night preceding a day in the range.
You could conditionally add a day when the stay period stretches across month end. This would make that period inclusive as opposed to a simple subtraction.
=MAX(0, MIN(EOMONTH(D$1, 0), $B4)-MAX(D$1, $A4))+(EOMONTH(D$1, 0)<$B4)
I'm trying to meticulously track interest growth and monthly payments on a loan in excel. Instead of manually putting in the amount for each first day of the month, is there a way to write an excel if statement so that it will be a certain value for the first day of a month and zero on all other days?
Sort of like: =IF("day is first day", $100,$0) That way I can drag the formula all the way down. Worth noting that inside the quotation marks will be a cell number that points to the column directly left of the formula with a date in it.
So like this:
| Date | Payment | Balance |
|:--------:|:-------:|:-------:|
| 01/30/16 | $0 | $1000 |
| 01/31/16 | $0 | $1000 |
| 02/01/16 | $100 | $900 |
| 02/02/16 | $0 | $900 |
Try this
=IF(A2=Date(Year(A2),Month(A2),1),100,0)
You need the DAY Function.
=IF(DAY(A2) = 1,100,0)
You can use the DAY() function to get the day number
=IF(DAY(A1)=1,100,0)