Excel month formula - excel-formula

I want to show specific text for whether something is due for any given month in a financial year or overdue if that month has passed. The formula I am using is as below and works fine until I get to January.
I am using the numerals 7-12 in this formula to represent respective month but am unsure how to ensure the number 1 relates to the next year. For that matter I guess my equation below for overdue for December won't work either.
=IF(MONTH(TODAY())=12,"DUE",IF(MONTH(TODAY())<=12,"",IF(MONTH(TODAY())>=12,"Overdue")))
Any help would be appreciated

Instead of the month number, let A1 equal the first of the month in which it's due. (Note the first of the month is what you'll get if you just type in the month and year, eg August 2014)
=IF(TODAY()<A1,"",IF(TODAY()>EOMONTH(A1,0),"Overdue","Due"))

Here is a solution that you can use. This includes a =YEAR( function and an =AND function to extend on what you already have.
The formula you can use is here.
=IF(AND(MONTH(TODAY())=MONTH(A2),YEAR(TODAY())=YEAR(A2)),"Due",IF(AND(MONTH(TODAY())>MONTH(A2),YEAR(TODAY())>=YEAR(A2)),"Overdue",""))
you can add the year into the comparison which will eliminate your problems with January.
Just wrap the month check and year check in an =AND( function when both conditions are TRUE you can enter your result.

Related

Index Match to match date between two dates

I have a date column B that are dates. My Fiscal year begins April 1 and ends March 31, I have my date ranges below:
Here is my formula including named ranges. I'm getting N/A error, and I'm not sure what I'm doing wrong.
{=INDEX(fiscalyear,MATCH(1,(startdate>=B2)*(enddate<=B2),0))}
You can get rid of the lookup with:
="FY" & YEAR(EOMONTH(B2,9))
Since any fiscal year starts right after a fiscal year ends you can just use:
=INDEX(fiscalyear,MATCH(B2,startdate,1))
Although both of the previous answers are correct and the formulas are simpler than the original one, I would like to point out where the original problem was - the comparison operators were swapped there.
It was:
{=INDEX(fiscalyear,MATCH(1,(startdate>=B2)*(enddate<=B2),0))}
Must be:
{=INDEX(fiscalyear,MATCH(1,(startdate<=B2)*(enddate>=B2),0))}

IF(A1=TOMORROW(),

How do I set one day before today; for example I would like a warning the day before a birthday..
=IF(C10=TODAY(),HYPERLINK("mailto:"&D10&"?subject="&$C$4&"&body="&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($C$5,"$",B10),"#",$C$6),CHAR(10),"%0A"),"Send mail"),"")
Excel stores dates as numbers. You can easily do simple maths with dates, like adding or subtracting days. A day is 1. Seven days is 7.
Today() is a function that returns the current date. To get yesterday's date, subtract a day from Today() like =Today()-1. To get tomorrow's date add a day to Today() like =Today()+1.
This arithmetic can also be applied inside of more complex functions. The formula in your question looks at Today() and compares it to C10. If you want the same functionality if the date in C10 is "tomorrow", you nee to add a day to Today().
That's what Jeeped's comment means.
=IF(Today()+1=C10,[the rest of your formula]

If Date Exceeds Certain Date Then

How do I set a formula or VBA to get around this?
If Date Listed in Column A + (7 Days) Exceed 5th of Upcoming Month then Do Something.
Its like 5th of Each Month is Deadline.
If Column A = 30th March 2015 +(7days)left = 6th April 2015 then Column B = "HolyCrap" Else "You're Safe"
I would really appreciate some help on this.
Let's try this formula:
=IF(AND(DAY(A1+7)>5,DAY(A1+7)<13),"screwed","safe")
The date in A1 could be in either Date or Number format. You would get the correct Number format after pressing Ctrl+;.
Please test it and let me know if for some date it does not return the correct result.
You can use 3 different functions to achieve this in Excel: IF, TODAY and DAY360.
You need a column to calculate the present date. Use TODAY function for that.
You need a column to calculate the number of days difference between the two dates (that is, the present date and your target date). Use the DAYS360 function for that.
Then on the cell / Column you require to display whatever you want it to display use the IF function. It will help determine if the current date is over or under your specified value in days, and return whatever value you want displayed; overdue, expired, Yes, No etc. Example:
=IF(P2>30,"Expired","Active")

Excel 2010: Get next months 1st Tuesday from a date generated with VLOOKUP

Program: Excel 2010
Experience Level: Basic
Hi there,
I am creating an Invoice which pulls data in from other sheets via VLOOKUP, the page is full of formulas and code (which I'm happy with), however I am having an issue when it comes to setting a date.
The issue:
When I use the formula to get my "1st Tues of the following Month" referencing cell (F3) the formula does not work. The date in (F3) has been generated by a VLOOKUP, so I believe my new formula is erroring out because it doesn't have a "Date", just a result of code.
Here are my formulas:
Cell(F3) =IF(TEXT(VLOOKUP($F$2,OrdSum,24,FALSE),"mmm-dd-yyyy")="","",(TEXT(VLOOKUP($F$2,OrdSum,24,FALSE),"mmm-dd-yyyy")))
Results: Jan-31-2014 (It is pulling the last day of the sales month which I manually write in every month from my OrdSum, I don't want it dynamic).
Cell(A14) =((EOMONTH(F3,0)+1)+7)+CHOOSE(WEEKDAY((EOMONTH(F3,0)+1)),2,1,0,6,5,4,3)
Results: #VALUE!
However if I have a hardcoded date in any cell the formula works and returns 11/02/2014
.
Even a simple =EOMONTH(F3,1) does not work, it results in the #VALUE! error.
Is there a workaround? Or do I have to write in the EOM manually on the Invoice as well.
Thanks in advance.
If the VLOOKUP is already pulling a date, you don't really need the TEXT part (you don't need it since if the VLOOKUP returns a blank, TEXT will convert it to 00-01-1900 anyway), this should suffice:
=IF(VLOOKUP($F$2,OrdSum,24,FALSE)="","",VLOOKUP($F$2,OrdSum,24,FALSE))
For cell F3. You only need to format F3 as mmm-dd-yyyy through custom formatting or date formatting.
EDIT: #Barryhoudini had a simpler formula for the 2nd Tuesday of the month. credit goes to him for this, I'm just elaborating a bit more here:
=EOMONTH(F3,0)+15-WEEKDAY(EOMONTH(F3,0)+5)
Will give the date of the 2nd Tuesday of the month. The last 5 is what determines what day of the week it is. You could perhaps re-write it like this to make it simpler:
=EOMONTH(F3,0)+15-WEEKDAY(EOMONTH(F3,0)+(7-3))
Where 3 is Wednesday. You can change the last number to mean these:
0 or 7 Sunday
1 Monday
2 Tuesday
3 Wednesday
4 Thursday
5 Friday
6 Saturday
The following formula, at the expense of some verbosity, does away with the VLOOKUP (which always makes spreadsheets brittle), and any formatting considerations.
If cell A1 contains a date, then
=1 + EOMONTH(A1,0) + MOD(3 - WEEKDAY(1 + EOMONTH(A1,0)),7)
returns a date that is the first Tuesday of the following month. Tuesday has a weekday value of 3 which is why this literal appears as the first term in the MOD(.
If you wanted to centre on, say Thursday (which has a weekday value of 5), then write
=1 + EOMONTH(A1,0) + MOD(5 - WEEKDAY(1 + EOMONTH(A1,0)),7)

Excel Calculate the date difference from today from a cell of "7/6/2012 10:26:42"

So I have a cell with 7/6/2012 10:26:42 inputted, I want to show the date difference from today in another cell.
I tried to extract 7/6/2012 with =LEFT(A1, Find(" ", A1, 1) -1) but turned out theres a value error.
The formula works when I make A1 '7/6/2012 10:26:42, however it is not ideal because I have to work with the whole column.
You can use the datedif function to find out difference in days.
=DATEDIF(A1,TODAY(),"d")
Quote from excel.datedif.com
The mysterious datedif function in Microsoft Excel
The Datedif function is used to calculate interval between two dates in days, months or years.
This function is available in all versions of Excel but is not documented. It is not even listed in the "Insert Function" dialog box.
Hence it must be typed manually in the formula box.
Syntax
DATEDIF( start_date, end_date, interval_unit )
start_date from date
end_date to date (must be after start_date)
interval_unit Unit to be used for output interval
Values for interval_unit
interval_unit Description
D Number of days
M Number of complete months
Y Number of complete years
YD Number of days excluding years
MD Number of days excluding months and years
YM Number of months excluding years
Errors
Error Description
#NUM! The end_date is later than (greater than) the start_date
or interval_unit has an invalid value.
#VALUE! end_date or start_date is invalid.
If that's a valid date/time entry then excel simply stores it as a number (days are integers and the time is the decimal part) so you can do a simple subtraction.
I'm not sure if 7/6 is 7th June or 6th July, assuming the latter then it's a future date so you can get the difference in days with
=INT(A1-TODAY())
Make sure you format result cell as general or number (not date)
For the difference between A1 and Today's date you could enter:
=ABS(TODAY()-A1)
which returns the (fractional) number of days between the dates.
You're likely getting a #VALUE! error in your formula because Excel treats dates as numbers.
DAYS(start_date,end_date):
For example:
DAYS(A1,TODAY())
Why don't you just make it easy and simple. If I need to know the number of days between today and say, March 10th, 2015, I can just enter the simple formula.
Lets say the static date is March 10th, 2015, and is in cell O5.
The formula to determine the number of days between today and O5 would be, =O5-Today()
Nothing fancy or DATEDIF stuff. Obviously, the cell where you type this formula in must have a data type of 'number'. Just type your date in normally in the reference cell, in this case O5.
=ROUND((TODAY()-A1)/365,0) will provide number of years between date in cell A1 and today's date
*In all instances the # refers to the cell number
You really don't need the datedif functions; for example:
I'm working on a spreadsheet that tracks benefit eligibility for employees.
I have their hire dates in the "A" column and in column B is =(TODAY()-A#)
And you just format the cell to display a general number instead of date.
It also works very easily the other way: I also converted that number into showing when the actual date is that they get their benefits instead of how many days are left, and that is simply
=(90-B#)+TODAY()
Just make sure you're formatting cells as general numbers or dates accordingly.
Hope this helps.

Resources