Closed Thread
Results 1 to 3 of 3

help please covariance

  1. #1
    Registered User
    Join Date
    MS-Off Ver
    Excel 2003

    help please covariance

    Hi people,
    I have a spreadsheet with M-1 rows and N colomns. I want to calcolate the covariance matrix of the spreadsheet and i would like like output an other spreadsheet. I tried to do my self, but no so much result. here my code, but there is a listake
    Sub cov()
    Dim LR As Long, i As Long, j As Long, LC As Integer
    Dim ws1 As Worksheet, ws2 As Worksheet
    Application.ScreenUpdating = False
    Set ws1 = Sheets("DIFF")
    Set ws2 = Worksheets.Add
    With ws1
    LR = .Cells(Rows.Count, 1).End(xlUp).Row
    LC = .Cells(1, Columns.Count).End(xlToLeft).Column
    For i = 1 To LR - 1
    ws2.Cells(i, i) = Application.Covar(Cells(i, i), Cells(i, i))
    For j = i + 1 To LC
    covval = Application.Covar(Cells(i, i).Value, Cells(i, j).Value)
    ws2.Cells(i, j) = covval
    ws2.Cells(j, i) = covval

    Next j
    Next i
    End With
    Application.ScreenUpdating = True
    End Sub

    Please help me. The mistake has to be in this line ws2.Cells(i, i) = Application.Covar(Cells(i, i), Cells(i, i))
    can I use excel function for generic cells?
    Also I have to diagonilize the matrix and to find the much work head till tomorrow
    Also I find some problem in interface cells and spreadsheet. Somebody know some good tutorial?


  2. #2
    Forum Guru shg's Avatar
    Join Date
    The Great State of Texas
    MS-Off Ver
    2003, 2010

    Re: help please covariance

    Welcome to the forum.

    Please take a few minutes to read the forum rules, and then edit your post to add code tags.

    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert oldchippy's Avatar
    Join Date
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)

    Re: help please covariance


    You have broken two of the forum rules please read them and amend your question - thanks

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1