EXCEL VBA if or

haijaggu143

New Member
Joined
Jan 23, 2019
Messages
4
Hi all,


Please help to run this formula if the day in cell C2 value is saturday

Range("F2").Formula = "=IF(AND(D2>=TIME(9,16,0),D2<=TIME(11,59,0)),D2-TIME(9,0,0),IF(AND(D2>=TIME(14,16,0),D2>=TIME(12,00,0)),D2-TIME(14,0,0)*1,0))"

and if Cell C2 value is Sunday to Friday


Range("F2").Formula = "=IF(AND(D2>=TIME(8,16,0),D2<=TIME(10,30,0)),D2-TIME(8,0,0),IF(AND(D2>=TIME(12,16,0),D2>=TIME(10,31,0)),D2-TIME(12,0,0)*1,0))"



Until the last row which has data in the sheet.

In short check the value in C2, if = saturday formula 1 or formula 2.


Thanks in advance

Jagadeesh Balakrishnan
 

Some videos you may like

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

haijaggu143

New Member
Joined
Jan 23, 2019
Messages
4
From C2 onwards Column C contains date
05/03/2019
06/03/2019
07/03/2019

<colgroup><col width="64" style="width:48pt"> </colgroup><tbody>
</tbody>
 

Watch MrExcel Video

Forum statistics

Threads
1,109,466
Messages
5,528,972
Members
409,848
Latest member
Blomsten
Top