Vertical line showing current week in timeline - vba

Ok so I recently added a vertical line showing the current week in a chart using this method: http://www.officetooltips.com/excel/tips/how_to_add_a_vertical_line_to_the_chart.html
but now I want to add one to a sheet without a chart. Is this possible?
So my timeline looks like this:
Is vba needed or is this possible with formulas I really have no idea.

You can make it auto update every week using NOW() formula:
What you have to make sure is that each column is formatted based on the cell in row A (or any other row/column) so you format all cells based on the dates in the first row. To look from each cell to the second row you use OFFSET($A$1,1,COLUMN()-1) and get the relevant date for this column. This could be done for any other cell that holds the relevant date for the column, but there must be one like this. The condition in the figure is one for all the table.
EDIT:
To match the format of YYMM for the date, use the formula (assuming $D$2 is the upper left cell of the table):
=OFFSET($D$1,1,COLUMN()-COLUMN($D$1))=RIGHT(YEAR(NOW()),2)*100+WEEKNUM(NOW())
for the current week, or replace the NOW() in it with a cell with the date of interest.
Hope it solves your problem ;)

Related

LibreOffice Calc (date has past coditional formatting)

I am building a to do list in LibreOffice. I have one column that describes the task and next to it is the deadline date. I would like any task that is past it's deadline to be a different color. Is it possible to do this using conditional formatting?
Just to clarify. I just managed to work something out by using "if cell value is less than TODAY()" however this only changes the look of the date cell. I also need to change the two cells in front of the date.
Thanks in advanceImage of to do list
Just figured it out. Just selected the entire list and used conditional formatting 'formula is $C2 < TODAY()'. This seems to work fine.

Using offset to create a dynamic range

I currently have a column, which starts at B28 (The title) and from B29 Values.
I add data to the column using a macro, and calculate the mean and standard deviation of the profit figures. Since i add data, I can't just select for example B29:B10000 as it will skew any mean and standard deviation, as it will also take into account blank cells. Therefore, I need to create a range, which will update when data is added and will only range from the first to last numerical figure, no blank cells.
The current formula I use which does not work:
=OFFSET('Panel'!$B$28,1,0,COUNTA('Panel'!$B28:$B999)-1,1)
(also tried selecting the whole column $B:$B but did not work)
Is there any solution for this?
Cheers
yes. Convert the range to table.
Use normal formula e.g. from average(B2:B9) to average(tablename[Profit])
Before Year 8 is added
After Year 8 is added - auto update

How to color a cell based on values and date difference in another cell using VBA

Consider I have a Table A in Excel - details as below:
And another Table B as follows
I want out-put as follows,
The Name from Table B has to be checked with Name in Table A, and respective StartDate and EndDate should be picked from Table A and same should be compared with dates in Table B and cell under that name should be colored to green if Status in Table A is in "In Progress" or to Red if in "On hold"
For Example:
Consider Jack in Table B, it has 3 records in Table A, The first start date should be picked i.e 4-Apr-2017 and End date as 27-Apr-2017, and respective coloring has to be done based on status field.
How can I achieve this using VBA/anything in Excel. I'm new to VBA.
Yes you can do it in VBA but I would recommend using conditional formatting (formula) as it doesn't require programming knowledge. To do this, you will need to employ the Vlookup formula.
I believe the output you want is something in the picture link here?
To make conditional formatting, look in the "Home" tab, under Styles -> Conditional Formatting. Highlight the cell you want to format, then select Conditional Formatting -> New Rule. This will cause a new window to pop up. Select "Use a formula to determine which cells to format".
You would want 2 conditional formats.
1.To show green if the date is within the start and end date. To do so, select the first cell in the Gantt chart (cell B8 in example) then enter formula below.
=IF(AND(B$7>=VLOOKUP($A8,$A$2:$D$5,3,FALSE()),B$7<=VLOOKUP($A8,$A$2:$D$5,4,FALSE())),TRUE(),FALSE())
2.To show red when user has item beyond due date, enter formula below with same cell highlighted.
=IF(B$7>VLOOKUP($A8,$A$2:$D$5,4,FALSE()),TRUE(),FALSE())
Once that is done, you can apply the format painter or copy and paste the cell with conditional formatting to extend your table/Gantt chart.
Note that the $ signs are important as they lock the relative reference positions in the formulas. Using the second formula as an example, B$7 refers to the date and you need the reference to be locked to row 7, where all the dates are. On the other hand, the column reference (Column B) can be shifted as you want it to change to with the columns to properly compare against the other dates.
As for multiple items per user, can you expand upon your initial question? Would you like to track based on per user or per item? I am assuming that you're creating a Gantt chart to track a project. In that case, it would make more sense to track specific tasks assigned to people. You can modify the example given to track based on task.

I am trying to write a vba code to extract Data from a workbook based a given date range. User should be able to enter date range

I am trying to write a simple vba code to extract data from the work hour sheet. User should be able to specify a date range and the vba code should able to extract the data based on the range.
The hour sheet has dates mentioned in the columns and work items in the rows. Users put their hour spend for the day against the given work item in the corresponding dates.
For ex. if I select range 01-08-2015 to 01-08-2015 the code should be able to extract the hour spend in the given date range for the particular work item. The data should then be shown to the user in the Calculations sheet.
I was looking to add a command button to facilitate the process
Work Items are arranged in rows and dates are arranged in columns.
Without seeing the spreadsheet, my gut would say to try something like this. Create a new sheet that has a spot for the starting date and ending date to be put in cells, eg A2 = starting date and B2 = ending date. If this is for a user, have the label for this in A1 and B1. Add a command button that will run the macro. macro should use a loop to find all the dates within the range, it would be easiest if the master data sheet was sorted, then have the code copy and paste the cells as needed. Without more details on the sheet layout, I can't really put some code together for you.

Autofill Custom List

I am trying to code a schedule generator in Excel using formulas or VBA that can automatically fill in the correct cells with data from a custom list (it can be stored anywhere - another spreadsheet, somewhere in the same sheet). Does anyone know an easy way to do this using VBA/Excel formulas or some other method (maybe even a better program to do it in)?
A user should type the start date in a cell and then it automatically fills in the same data into the weekdays, skipping weekends and holidays, which are also user inputted somewhere in a spreadsheet.
This picture explains what I am trying to accomplish:
There would be a place to input a new class and start date and the rest would auto fill. The custom list would be the titles (i.e. Database Basics, Tables, Primary Keys, Foreign Keys and so on)
The top two rows are date and day of week (that part is easy) but then give a start date fill in the list (until you reach the end of the list) in the weekdays but do not fill in weekends or user chosen holidays. Ideally this would work for every row. So if I have multiple start dates then maybe rows 3,4,5 would have different schedules but I can see where they coincide and do not based on this simple view.
This is a description of a technique that you may adapt for your use. Say we want to auto-fill dates (working days) in row #1 based on a staring date in cell A1.
Leave A1 empty. Format the cells in row #1 as Date.
In B1 enter:
=IF(A1="","",WORKDAY(A1,1))
and copy across. Now when a date is entered in A1, the rest of row #1 will follow suit.