Solved

Add rows dynamically

Posted on 2011-09-15
5
178 Views
Last Modified: 2012-05-12
I have a spreadsheet I am making up for holidays (attached) and I want to produce a list as part of the sheet that dynamically shows the days being taken off.

In the example there was a full day taken (8 hours) on 1,3,6 and 8 October and a half day taken on 2 and 15 October.
What I want to do is to add a new row in before the totals row (row 13) each time holidays are taken so that you can see the date easily and the total days taken.

So for example, if a half day off (4 hours) was taken on 20 October, A13 would change to “20-Oct-11”, B13 would change to “0.5”, A14 would change to “Total” and B14 would change to “5.5”

I don’t want to use VBA for this if it can be done in another way.

Thanks

Holiday.xlsx
0
Comment
Question by:GordonMasson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Expert Comment

by:Hernan_Cano
ID: 36544939
You can use pivot tables.

I have attached an example of a possible solution.

Holiday-PivotTable.xlsx
0
 
LVL 2

Expert Comment

by:Hernan_Cano
ID: 36544955
Some notes:

- For setting the daily titles, change only the value in C1.
- You can change the day-hours equivalency.
- After any change, you have to right click in the pivot table and select "refresh" to update it.

The pivot table uses the same information in a different format (set in Sheet2) for easier and more flexible formatting.
0
 

Author Comment

by:GordonMasson
ID: 36547979
Hi Herman

Looks great.
I have a question though. I am going to run this for a calander year so i need the dates in sheet 2, column B to look like you have set up.......
=Sheet1!C2
=Sheet1!D2
=Sheet1!E2

If i set B2 and then drag it down the row number changes rather than the column number.
How do i change it to mak it the column number that changes?

Thanks
0
 
LVL 2

Accepted Solution

by:
Hernan_Cano earned 500 total points
ID: 36551952
For this particular example you can use in column B:

 
=IFERROR(INDIRECT("Sheet1!" & SUBSTITUTE(ADDRESS(1,ROW()+1,4),"1","") & "$2"), "0")

Open in new window


This gets the column dinamically according to the row number where it's used with ADDRESS.
Then it strips the number from the address with SUBSTITUTE.
Next we get the required value from the Sheet1 with INDIRECT using the calculated letter and fixed number.
Finally I added zero as the default value in case anything goes wrong in the formula.
0
 

Author Closing Comment

by:GordonMasson
ID: 36572518
Thanks for your help
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question