Macro to add rows based on conditions and sum/subtotal lines above

boomerang_1

New Member
Joined
Jun 27, 2019
Messages
1
Hi All,
Just checking if anyone is able to assist me with setting up a code to add rows (based on a condition) and sum lines above.
Raw data is is below.

StateStoreStaff NameDayDateHours Category 1Hours Category 2Hours Category 3Hours Category 4
StateStore 1Staff 1Tuesday11/06/198.558.500.050.00
StateStore 1Staff 1Wednesday12/06/198.178.120.050.00
StateStore 1Staff 1Thursday13/06/196.326.320.000.00
StateStore 1Staff 1Friday14/06/198.328.300.020.00
StateStore 1Staff 1Saturday15/06/196.936.930.000.00
StateStore 1Staff 2Tuesday11/06/198.288.230.050.00
StateStore 1Staff 2Wednesday12/06/197.427.420.000.00
StateStore 1Staff 2Thursday13/06/196.486.480.000.00
StateStore 1Staff 3Friday14/06/193.273.270.000.00

<tbody>
</tbody>

I would like the macro to do the following;
> If staff1 works from Mon-Fri (weekday), then add row and sum hours (bold font & top border if possible)
> If staff1 works form Sat to/or Sun (weekend), do nothing (i.e. just list the hours)

Result:

StateStoreStaff NameDayDateHours Category 1Hours Category 2Hours Category 3Hours Category 4
StateStore 1Staff 1Tuesday11/06/198.558.500.050.00
StateStore 1Staff 1Wednesday12/06/198.178.120.050.00
StateStore 1Staff 1Thursday13/06/196.326.320.000.00
StateStore 1Staff 1Friday14/06/198.328.300.020.00
31.3531.230.120.00
StateStore 1Staff 1Saturday15/06/196.936.930.000.00
StateStore 1Staff 2Tuesday11/06/198.288.230.050.00
StateStore 1Staff 2Wednesday12/06/197.427.420.000.00
StateStore 1Staff 2Thursday13/06/196.486.480.000.00
22.1822.130.050.00
StateStore 1Staff 3Friday14/06/193.273.270.000.00
3.273.270.000.00

<tbody>
</tbody>

Thank you so much for your help.
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Watch MrExcel Video

Forum statistics

Threads
1,099,255
Messages
5,467,573
Members
406,543
Latest member
semoredhawk

This Week's Hot Topics

Top