Get upcoming Saturday from the list of dates - excel-formula

I want to get the upcoming saturday with reference to current system date.
The formula should give June 5 when the system date is May 29 till June 4, when the system date is June 5 it would return the next upcomin Satuday
This formula returns all matching dates, but I need a single upcoming date as a result and not a range result.
=iferror(ARRAYFORMULA(if(A2:A>today(),A2:A, 0/0)))

This formula will return the next saturday, even if today IS a saturday
=TODAY()+(7-WEEKDAY(TODAY()))+(7*(7=WEEKDAY(TODAY())))
Replace TODAY() with a reference to a cell to use a different date

Related

How to get week number based on Two dates based Conditions in Excel

I have a DateTime column in Excel in which data is sorted in ascending order based on DateTime conditions from 15th June to say 1st November ;
I want to print Week Number from 1st to Nth Week based on date condition; Week criteria are like first seven days i.e 15th June to 21st June is Week1, 22nd Jun-28th Jun is Week2, 29th June - 5th June is Week3 and so on.
How Can I do this?
Column1
06/15/2021 8:00
06/15/2021 10:00
:
:
11/01/2021 20:44
11/01/2021 20:46
Let's assume your list of dates is in A2:A.
Place the following formula in cell B2 of an otherwise empty range B2:B...
=ArrayFormula(IF(A2:A="",,ROUNDDOWN((INT(A2:A)-INT(A2))/7)+1))
INT is just removing the times from date-times.
The rest is really more of a math/logic question than a formula question.

Find first date after today that matches a day-number and weekday

Given any date, how do I find the first month and year in the future where the 31st of that month falls on a Wednesday, in other words, for today, 11 November 2020, I would like to see (31) March 2021. [Updated: Returned month should be March 2021]
#prino,
You could make use of Excel's Iterative Calculation, setting Maximum Iterations to 1000.
In the example below, A1 is the given date and B1 receives the result (put the formula in B1):
=IF(B1=0,A1)+B1+IF(AND(WEEKDAY(B1,1)=4,DAY(B1)=31),0,1)
If you have Excel 365 then
=LET(DayInMonth, DATE(YEAR($A$2),MONTH($A$2)+SEQUENCE(336,,0,1),$B$2),
DOW, WEEKDAY(DayInMonth),
IsMatch, (DAY(DayInMonth)=$B$2)*(DOW=$C$2)*(DayInMonth>=$A$2),
XLOOKUP(1,IsMatch,DayInMonth,,0,1))
How it works:
Parameters are on the sheet (you could hard code these into the formula if you wish)
A2 is the start date (could be formula =TODAY())
B2 is the day number in the month
C2 is the day of week code (1..7 = Sunday..Saturday)
The calander repeats every 28 years. So only need to consider 12*28 = 336 months
DayInMonth is the specified date in each of the next 336 months, including this month. Note: if a month does not have the specified day (eg 31 September does'nt exist)
DOW is the day of Week code for those dates
IsMatch is 1 if calculated DayInMonth matches specified DayInMonth (this excluded non-existant dates) AND Calculated DOW matches specified DOW AND calculated date is on or after start date
XLOOKUP returns the date of the first 1 in the IsMatch array

Excel Formula for finding if the 16th lands on a Saturday or Sunday and if it does, returning the date of the following Monday

Imagine that in cell A1 you have the first day of the month. I need a formula that finds if the 16th day of that month falls on a weekend (Saturday or Sunday) and if that is the case, return the date of the following Monday. If the 16th is not on a weekend, it will just return the date of the 16th
=If( (A1 + 15) = Saturday or Sunday, Date of the next Monday, (A1 + 15) )
I apologize in advance for my formula being terrible, I'm at a loss on this one.
For example, if A1 = "10/1/2019" then the forula will return 10/16/2019 because the 16th is not a weekend. However, is A1 = "11/1/2019" then the formula will return 11/18/2019 because the 16th is a Saturday. Thanks!
You can use the WEEKDAY function to determine the day of the week.
=IF(WEEKDAY(A1+15,2)=6,A1+17,IF(WEEKDAY(A1+15,2)=7,A1+16,A1+15))
The workday function is probably the easiest way to do this:
=WORKDAY(A1+14,1)
A1+14 --> the fifteenth of the month
We then add one workday. If that added workday falls on a Sat or Sun (or optional holiday if you want to do that), the weekend days will be skipped, otherwise the 16th will be returned.

how can i exclude FRI and SAT days from the calculation of days passed

I need to exclude FRI and SAT days from the formula which counts the days from date in cell A1 until the date of Today(), and subtracts A1 from Today()
i have already the formula which checks first if A1 has a value, if yes subtracts the value from Today(), if not it will say "NO VALUE"
i also know there is code to exclude FRI and SAT but i'm having a hard time incorporating it into my formula:
This will count 8 days from Start_Date in A1, and excludes FRI and SAT:
=WORKDAY.INTL(A1,8,7)
This is my current formula which shows the number of days, but i want it to skip FRI and SAT:
=IF((A1<>""),((TODAY()-A1)),"NO VALUE")
You can use NETWORKDAYS rather than WORKDAY:
=IF(A1<>"",NETWORKDAYS.INTL(A1,TODAY(),7),"NO VALUE")
It might not be the best way to do it but I found a work around.
You can calculate the total number of day and remove the number of Friday and remove the number of Saturday.
I found this that count how many Friday in a specific date range.
For example:
=SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(Date1&":"&Date2)))=5))
It basically retrieve all the date in the range in their numerical value and test if if it is a Saturday and give you the amount of Saturday between 2 dates.
In your case you could use it to remove the Friday and Saturday like below:
=IF((A1<>""),((TODAY()-A1-SUMPRODUCT(-(WEEKDAY(ROW(INDIRECT(A1&":"&B1)))=5)) -SUMPRODUCT(--(WEEKDAY(ROW(INDIRECT(A1&":"&B1)))=6)))),"NO VALUE")
Where B1 is today's date.
And example:
example using the formula
Hope this helps.

Calculating Based on an Array in Excel

I have a Pivot Table that I am able to cycle through the different months based on a Month Filter (changing the data of the table). I am trying to calculate based off of that change of value. I am recording the amount of times a license is used in a workday. The number of workdays in a month change based on the month. I calculated out the workdays for each month using
=NETWORKDAYS(H34,EOMONTH(H34,0),J34:J45)
H34 references my 1/1/2016 date. J34:J45 references my holiday dates to avoid.
I am trying to write a formula that says "If the month listed (from my month filter) within the Months list then to print the corresponding Workdays value.
=IF(G34:G46=H48, I34:I46)
It only works on January. The rest of the values return False. I do calculate it as an Array Function. It returns either False. I cannot think of another function that could replace it. Any help would be appreciated.
2016
Month Date Workdays Holiday Dates Holidays
January 1/1/2016 19 1/1/2016 New Year's day
February 2/1/2016 20 18-Jan Holiday 2
March 3/1/2016 22 2/15/2016 Valentines day
April 4/1/2016 21 3/25/2016 St. Patrick's Day
May 5/1/2016 21 5/30/2016 Memorial Day
June 6/1/2016 22 7/4/2016 Independence Day
July 7/1/2016 21 9/5/2016 Labor Day
August 8/1/2016 23 10/10/2016 Holiday
September 9/1/2016 22 11/8/2016 Columbus Day
October 10/1/2016 21 11/11/2016 Veteran's Day
November 11/1/2016 21 11/24/2016 Thanksgiving
December 12/1/2016 21 12/26/2016 Christmas
All 235
Selected Month
March FALSE
The VLOOKUP() function will greatly simplify this process for you. This particular function is great for extracting values in a list based on a key lookup field.
In your example, you want to easily extract the value from Holiday Dates column based on an input month.
A few things to keep in mind for the input parameter functions in this function:
The first column in your table array must contain the lookup value, in this case, the month column.
If may need to lock your array dimensions, use the $ sign in front of the column letter and row number.
FALSE should be selected for the range_lookup in order to do exact matching for the lookup value. If you choose false, you may get false positivies.
Every row in your list should be unique for the lookup value. Let's say January was listed twice, the value returned would be for the first occurrence.
Additional info:
http://spreadsheeto.com/vlookup/
http://www.howtogeek.com/howto/13780/using-vlookup-in-excel/
You can use the LOOKUP function, as follow:
=VLOOKUP(G48,G34:I45,3)
This formula looks up "G48" value in column G (first matrix column), and returns the value from column I (third matrix column) that is in the same row.
Read this official Office page for more details.
Please, give us your feedback.

Resources