Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
You could use the "stack" function for your first problem and for the second you could write a custom function to create a matrix to your specifications.
BTW, its always better to additionally attach the worksheet itself additionally and not just post pictures.
