Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Advice on Approach to Convert List of Dates into a Calender format

Hi All,

I am after some advice on how to tackle a problem I regularly come up
against - I am currently updating this manually but it is quite time
consuming and open to errors. I have a list of dates of when certain events
will take place on the Source Data sheet. The data is formatted as
follows:-

Task ID Task Name Task Start Date Task Finish Date Location

The calender sheet then has the date listed in column A, and 1 column for
each Location. Each cell on the calender sheet then obviosly refers to a
specific location on a specific day. I essentially need to transfer the
information from the date list onto a calender so that the relevent task
name appears in the related date / location cell.

I have been trying to do this using a function that contains a Sumproduct
formula (using evaluate) but it is very complicated and seems a very hard
way to do it. Has anyone else had to do anything similar to this? Any
advice? I was trying to create a dynamic solution but the problem here will
be if any of the tasks overlap?

I have included my current code below just in case someone can spot my
mistake.

Thanks

Andi

Function DepCHRT()



Dim Var_WorkBK As String, Var_SheetZZ As String

Dim Var_ENV_ColNum As Integer, Var_ENV_ColLet As String

Dim Var_Date_Row As Integer

Dim strTask_Start As String, strTask_Finish As String, strTask_Type As

String

Dim str_Date As String, strTask_DCIT As String

Dim ColType As String, EvalSTR As String, str_Type As String



'Find Location of Function

Var_WorkBK = Application.Caller.Parent.Parent.Name 'Workbook

Var_SheetZZ = Application.Caller.Parent.Name 'Sheet

Var_ENV_ColNum = Application.Caller.Column 'Column

Var_Date_Row = Application.Caller.Row 'Row where date is

ColType = Col2Type(Var_ENV_ColNum) 'Column Type string

'ColType = """" & ColType & """"



'Convert Column number to Letter

If Var_ENV_ColNum 26 Then

Var_ENV_ColLet = Chr(Int((Var_ENV_ColNum - 1) / 26) + 64) & _

Chr(((Var_ENV_ColNum - 1) Mod 26) + 65)

Else

' Columns A-Z

Var_ENV_ColLet = Chr(Var_ENV_ColNum + 64)

End If



'Strings for use in evaluate formula

strTask_Start = "'" & Var_WorkBK & "'!LU_DC_Start" 'Address of Task

Start

strTask_Finish = "'" & Var_WorkBK & "'!LU_DC_Finish" 'Address of Task

Finish

strTask_Type = "'" & Var_WorkBK & "'!LU_DC_Type" 'Address of Task

Type

strTask_DCIT = "'" & Var_WorkBK & "'!LU_DC_ID" 'Address of DC task

ID



str_Type = "'" & Var_SheetZZ & "'!$" & Var_ENV_ColLet & "$65536"

'Address of Cell's Date

str_Date = "'" & Var_SheetZZ & "'!$A$" & Var_Date_Row 'Address of Column

Type





'Evaluate Formula

EvalSTR = ("SUMPRODUCT((" & str_Date & "=" & strTask_Start & ")" & _

"*(" & str_Date & "<=" & strTask_Finish & ")*" & _

"(""" & ColType & """=" & strTask_Type & ")*(" & strTask_DCIT & "))")



DepCHRT = Evaluate(EvalSTR)



Exit Function



Err: 'Error Handling

DepCHRT = "Error"

End Function






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i convert dates to text but keep the date format SallyP Excel Worksheet Functions 1 April 13th 10 10:01 PM
CONVERT DATES FROM EUROPEAN FORMAT TO US FORMAT les8 New Users to Excel 8 August 8th 06 05:48 PM
need to convert list of dates to count no. of dates by week neowok Excel Worksheet Functions 13 January 30th 06 03:54 PM
How to convert the dates from the YY:DD forma to MM/dd/YYYY format Sam Excel Worksheet Functions 4 July 15th 05 12:01 PM
How do I convert dates to text keeping the format? sprlarry Excel Discussion (Misc queries) 3 May 16th 05 06:06 AM


All times are GMT +1. The time now is 11:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"