Solved

Add rows dynamically

Posted on 2011-09-15
5
175 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Workbook link problems after copying tabs to a new workbook? David Miller (dlmille) Intro Have you either copied sheets to a new workbook, and after having saved and opened that workbook, you find that there are links back to the original sou…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now