[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Creating a calendar with horizontal bar for time duration

Posted on 2014-12-25
8
Medium Priority
?
81 Views
Last Modified: 2014-12-28
First this isn't exactly a Gantt chart. Plenty of examples but not specifically what I am looking for.

Row 1 would display dates (F1(1/1/2015 for example) to never ending)

Row 3 (C3 Start date, C4 end date, and C5 Duration, which is C4-C3) The rows would also be limitless

Is there a way that the start date could find a matching date in row 1 and the intersection (cell) would be filled in then the number of duration would fill, horizontally, the remaining cells? If the duration is 3 days then 3 cells are filled in.

Thank you for any assistance
0
Comment
Question by:dgd1212
[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
  • 4
  • 2
  • 2
8 Comments
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40517585
Can you manually create a small sample worksheet that shows your desired result?
0
 

Author Comment

by:dgd1212
ID: 40517729
Martin,
Per your request I have attached spreadsheet. I manually entered the filled in cells, which I hope to be the final result of picking dates.
Thank you for looking at this.TEST-Rolling-Calendar.xlsx
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40517745
Would a macro that creates/updates the "bars" when the duration changes be acceptable?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 49

Accepted Solution

by:
Martin Liss earned 1000 total points
ID: 40517802
The attached workbook contains the following macro which is called when the duration changes.  

Sub CreateBars()
Dim lngLastRow As Long
Dim lngRow As Long
Dim lngLastCol As Long
Dim lngCol As Long

With Sheets("CALENDAR")
    Application.ScreenUpdating = False
    
    lngLastRow = .Range("A1048576").End(xlUp).Row
    lngLastCol = .Cells.Find("*", SearchOrder:=xlByColumns, LookIn:=xlValues, SearchDirection:=xlPrevious).Column
    
    ' Clear the bars (the "Split(Cells(1, lngLastCol).Address, "$")(1)" part
    ' converts the column number into a letter)
    .Range("F3:" & Split(Cells(1, lngLastCol).Address, "$")(1) & lngLastRow).Interior.TintAndShade = 0
    
    For lngRow = 3 To lngLastRow
        ' Check duration
        If Val(.Cells(lngRow, 5)) > 0 Then
            For lngCol = 6 To lngLastCol
                ' Check to see if the cell's date falls between the
                ' start and stop values inclusive
                If .Cells(1, lngCol) >= .Cells(lngRow, 3) And _
                   .Cells(1, lngCol) <= .Cells(lngRow, 4) Then
                   .Cells(lngRow, lngCol).Interior.Color = vbBlack
                End If
            Next
        End If
    Next
    
    Application.ScreenUpdating = True
    
End With

End Sub

Open in new window

Q-28586739.xlsm
0
 
LVL 23

Assisted Solution

by:Ejgil Hedegaard
Ejgil Hedegaard earned 1000 total points
ID: 40517989
Or use conditional formatting with this rule in F1 for the range F:XFD
=AND($C1<=F$1,$D1>=F$1,F$1<>"")
TEST-Rolling-Calendar-cond-format.xlsx
0
 

Author Closing Comment

by:dgd1212
ID: 40520445
Both solutions worked. Not sure if one is more advantageous than the other but both function as needed. Many thanks for your help.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40520578
If you use the Conditional formatting approach I believe you'll have to update it if you add more dates, but in any case you're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0
 
LVL 23

Expert Comment

by:Ejgil Hedegaard
ID: 40521040
It is not needed to update the conditional format when more dates are added in row 1, or columns C and D.
The rule is set for all rows, and all columns from F to the last column on the sheet XFD.
Also clears the cell colour when input are deleted.
The last rule F$1<>"" ensures that cells with no date in row 1, does not turn black when comparing to empty cells in columns C and D.
If you want the rule to require data in column A and B also, change to
=AND($A1<>"",$B1<>"",$C1<=F$1,$D1>=F$1,F$1<>"")
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

656 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