Forum Discussion
wirebear
Oct 25, 2019Copper Contributor
Trying to get weekend dates that are typed in to round to nearest workday
Trying to get Saturday dates to round to Friday and Sunday Dates to round to Monday. I have formulas to do one or the other but can't figure out how to place both formulas for single cell. =IF(...
mathetes
Oct 25, 2019Gold Contributor
=IF(WEEKDAY(A5)=7,A5-1,IF(WEEKDAY(A5)=1,A5+1,A5))
the logic here is referred to as "nesting" in that the second IF is "nested" as the second alternative in the first or "outer" IF statement.
A simple IF function is read as IF([condition is met] THEN [do this] ELSE [do that])
And all you're doing is putting another IF function into the ELSE place, and this latter instance has as its ELSE, in your case, "Leave A5 untouched."
make sense?
the logic here is referred to as "nesting" in that the second IF is "nested" as the second alternative in the first or "outer" IF statement.
A simple IF function is read as IF([condition is met] THEN [do this] ELSE [do that])
And all you're doing is putting another IF function into the ELSE place, and this latter instance has as its ELSE, in your case, "Leave A5 untouched."
make sense?