![]() |
IF statement with Weekends vs. weekdays
I'm looking for an IF statement that basically says the following: IF R6 = a weekend (Friday,Saturday,Sunday) then K36 = Data!CY8*(1.23) IF R6 = a weekday (Monday - Thursday) then K36 = Data!CY*(1.13) I'm not sure how to have it determing the weekends vs weekdays. Thanks in advance. EP -- edwardpestian ------------------------------------------------------------------------ edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809 View this thread: http://www.excelforum.com/showthread...hreadid=539612 |
IF statement with Weekends vs. weekdays
edwardpestian Wrote: I'm looking for an IF statement that basically says the following: IF R6 = a weekend (Friday,Saturday,Sunday) then K36 = Data!CY8*(1.23) IF R6 = a weekday (Monday - Thursday) then K36 = Data!CY*(1.13) I'm not sure how to have it determing the weekends vs weekdays. Thanks in advance. EP Edward: The =WEEKDAY function returns 1 for Sunday through 7 for Saturday. Therefore formula in K36 should be =IF(OR(WEEKDAY(R6)5,WEEKDAY(R6)=1),Data!CY8*(1.23 ),Data!CY8*(1.13)) -- CaptainQuattro ------------------------------------------------------------------------ CaptainQuattro's Profile: http://www.excelforum.com/member.php...o&userid=32763 View this thread: http://www.excelforum.com/showthread...hreadid=539612 |
IF statement with Weekends vs. weekdays
=If(weekday(R6,2)<5,Data!CY8*1.13,Data!CY8*1.23)
"edwardpestian" wrote: I'm looking for an IF statement that basically says the following: IF R6 = a weekend (Friday,Saturday,Sunday) then K36 = Data!CY8*(1.23) IF R6 = a weekday (Monday - Thursday) then K36 = Data!CY*(1.13) I'm not sure how to have it determing the weekends vs weekdays. Thanks in advance. EP -- edwardpestian ------------------------------------------------------------------------ edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809 View this thread: http://www.excelforum.com/showthread...hreadid=539612 |
IF statement with Weekends vs. weekdays
OK. I learned something. The optional parameter ,2 changes the day numbers to 1 for Monday through 7 for Sunday. You can also use parameter ,3 which makes Monday 0, and Sunday 6 -- CaptainQuattro ------------------------------------------------------------------------ CaptainQuattro's Profile: http://www.excelforum.com/member.php...o&userid=32763 View this thread: http://www.excelforum.com/showthread...hreadid=539612 |
IF statement with Weekends vs. weekdays
Thanks all for the help, it's working perfect. Regards, EP -- edwardpestian ------------------------------------------------------------------------ edwardpestian's Profile: http://www.excelforum.com/member.php...o&userid=33809 View this thread: http://www.excelforum.com/showthread...hreadid=539612 |
All times are GMT +1. The time now is 05:33 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com