Add blank row in data set IF no data exists

davie_aus

New Member
Joined
Jul 5, 2018
Messages
6
Hey guys,

Sorry, pretty new to this stuff so hopefully i can accurately describe what im trying to achieve.

I need to have 3 rows for each DAY/NIGHT to filter through to more functions. At times, i only have 1 value for this shift so will need to insert 2 new rows to make things balance. I would like to run a Macro to insert blank rows back into the dataset. Does this make sence and is it possible?

Thanks alot!

What i have:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Day/Night Shift[/TD]
[TD]Date Code[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]800[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]700[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/3/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/3/2018[/TD]
[TD]690[/TD]
[/TR]
</tbody>[/TABLE]

And this is what im trying to get:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Day/Night Shift[/TD]
[TD]Date Code[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]800[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]700[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/3/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/3/2018[/TD]
[TD]690[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

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

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Day/Night Shift[/TD]
[TD]Date Code[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]800[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]700[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/3/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/3/2018[/TD]
[TD]690[/TD]
[/TR]
</tbody>[/TABLE]

And this is what im trying to get:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Day/Night Shift[/TD]
[TD]Date Code[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/1/2018[/TD]
[TD]800[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]700[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/1/2018[/TD]
[TD]600[/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/2/2018[/TD]
[TD]900[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Day[/TD]
[TD]1/3/2018[/TD]
[TD]1000[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Night[/TD]
[TD]1/3/2018[/TD]
[TD]690[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Yes, thats correct.

The amount of rows will vary, up to a max of 168 rows if that makes a difference.

If you need anything else, please let me know!

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top