PC Review


Reply
Thread Tools Rate Thread

Counting days and array element reference

 
 
330006@gmail.com
Guest
Posts: n/a
 
      21st Nov 2006
Hi all, I am new to excel, so pardon my ignorance. I did a search, but
still can't figure this out:

1. Suppose I have many rows of dates: "MAY99", "JUN99", etc. Each row
always referes to the third Friday of the month. I want to add a column
to the file: the number of days from the starting day. So if we set the
starting date to be 05/01/99, for the row of "MAY99", let's say the
third Friday of MAY of 1999 is May 20th. Then for this new column, the
entry for the new column is 20. (Ideally, I want to count in business
days, rather than calendar days)

How can I do that?

2. In other language, to acess certain row of an array is easy: A[i], I
can do a loop on i. For example:
i = 1,4,7,10,etc.

But how can I do this in excel/VBA? Let's say I want to refer to cell
A1, A4, A7, A10, etc? (as in VBA: i write "A8" not "A[8]" where "8" can
cange, so i find it hard.

Thanks a lot, appreciate your help!

 
Reply With Quote
 
 
 
 
Mika Oukka
Guest
Posts: n/a
 
      21st Nov 2006
Q1
to test fill range C4:B14 with test values 1999 and range B4:B15 should
include values from 1 to 12.
Formula for 1:st days weekday of month:
D4: =WEEKDAY(DATE(C4,B4,1))
Result 1=Sunday, 2=Monday,...

To find the 3:rd friday based on the 1st day calculation above
E5: =IF(D4<=6,(6-D4)+(2*7+1),(6-D4)+(3*7+1))

Workday might be the function youre looking also. Excels helps are specially
good for functions.

Q2
Here is one example how to use array and how to refer to cells.
Rws = Array("5", "9", "1")
For i = 0 To 2
Cells(Rws(i), 8).Select
Selection.Font.Bold = True
Next

You can also type "cells" to VBA code, select the word and press F1 for more
instructions.

-Mika

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all, I am new to excel, so pardon my ignorance. I did a search, but
> still can't figure this out:
>
> 1. Suppose I have many rows of dates: "MAY99", "JUN99", etc. Each row
> always referes to the third Friday of the month. I want to add a column
> to the file: the number of days from the starting day. So if we set the
> starting date to be 05/01/99, for the row of "MAY99", let's say the
> third Friday of MAY of 1999 is May 20th. Then for this new column, the
> entry for the new column is 20. (Ideally, I want to count in business
> days, rather than calendar days)
>
> How can I do that?
>
> 2. In other language, to acess certain row of an array is easy: A[i], I
> can do a loop on i. For example:
> i = 1,4,7,10,etc.
>
> But how can I do this in excel/VBA? Let's say I want to refer to cell
> A1, A4, A7, A10, etc? (as in VBA: i write "A8" not "A[8]" where "8" can
> cange, so i find it hard.
>
> Thanks a lot, appreciate your help!
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Counting Array element Steve Dunn Microsoft Excel Worksheet Functions 1 12th Apr 2010 03:18 PM
Rules for element-by-element product in array multiplication Paul Microsoft Excel Programming 2 22nd Mar 2008 11:42 PM
UDF to reference a specific element in an array GH Microsoft Excel Programming 4 8th Jan 2005 12:55 PM
Re: Excel2000: Replace array element with element from another array Harlan Grove Microsoft Excel Worksheet Functions 0 10th Sep 2003 07:28 PM
Re: Excel2000: Replace array element with element from another array Peo Sjoblom Microsoft Excel Worksheet Functions 0 10th Sep 2003 02:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:09 PM.