Solved

Add rows dynamically

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

840 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