+ Reply to Thread
Results 1 to 6 of 6

Reg:macro to find the downtime correlation.

  1. #1
    Registered User
    Join Date
    02-08-2014
    Location
    Chennai
    MS-Off Ver
    Excel office 365
    Posts
    41

    Reg:macro to find the downtime correlation.

    Dear all

    Note Excel2016

    I would like to develop a VBA macro to obtain the duration of a server outage that occurs when all servers are down simultaneously

    The server's uptime and downtime are displayed in the input table. The intended output of the macro can be found in the output table.

    Please assist me.

    Thanks in advance for your kind support

    isolation.png

    Regards
    Anavarathan S
    Attached Files Attached Files
    Last edited by anavarathan; 02-16-2024 at 04:32 AM.

  2. #2
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: Reg:macro to find the downtime correlation.

    Here is a solution with a single-cell formula for the whole table in one go (no copy needed):

    Please empty all expected results and try:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    02-08-2014
    Location
    Chennai
    MS-Off Ver
    Excel office 365
    Posts
    41

    Re: Reg:macro to find the downtime correlation.

    Quote Originally Posted by HansDouwe View Post
    Here is a solution with a single-cell formula for the whole table in one go (no copy needed):

    Please empty all expected results and try:
    Please Login or Register  to view this content.
    Thanks for your kind support

    is it possible to change this formula to work in excel 2016 or could please provide me vba script that can work in excel 2016.

    sorry for inconveience i am unable to change the excel verision in this forum.

  4. #4
    Forum Guru HansDouwe's Avatar
    Join Date
    06-21-2022
    Location
    Nederland
    MS-Off Ver
    365 V2403 (Build 17330.20000)
    Posts
    6,427

    Re: Reg:macro to find the downtime correlation.

    Thanks for the feedback and rep. I was happy to help you with a solution suitable for Office 365. .

    Unfortunately, this formula cannot be converted to a formula suitable for Excel 2016.
    This formula contains too many new features that can only be used in 365.

    I'm not familiar with VBA, but I'm sure a VBA solution is quite possible.

    I look forward to responses from VBA experts on this.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Reg:macro to find the downtime correlation.

    I didn't try to reverse engineer HansDouwe's solution, though I expect it does substantially the same thing. I also haven't tried to program it into VBA, as I want to be sure that you are satisfied with the algorithm before going to the trouble of testing VBA code (and because VBA may not be the best programming language for this).

    Here's what I did, as I said, just to fix the algorithm/procedure.

    1) Unpivot the input table so that I have a list "database" with a timestamp field, a server field, and a "state" field that indicates whether the timestamp corresponds to an "up" event or a "down" event. VBA does not have a built in "unpivot" command, but Power Query/Get and Transform does. If you are not required to use VBA for this, you might consider using Get and Transform/Power Query for this step. I don't have access to Power Query, so I just manually copied and pasted things (again, just to get the procedure down for now).
    2) Sort the list by time stamp from oldest to newest. I don't know all of what Power Query can do, but I would be highly surprised if Power Query doesn't include a build in sort command (again, VBA doesn't really have a sort command).
    3) Once I have the list sorted by timestamp from oldest to newest, then I go through each timestamp and identify the state of each server at each timestamp. I used simple worksheet functions for this step, but VBA would also be able to do this. Because steps 1 and 2 are probably easiest in Power Query, it might be best if Power Query could do this step as well (I don't know if PQ is capable, but would be optimistic that it could be done).
    4) Once I know the state of each server at each timestamp, I can capture/filter the list for those timestamps where all three servers are "down," and extract that timestamp and the following timestamp. I used the worksheets built in filter functions. VBA can use the worksheets filter functions, but does not have its own filter command. PQ, has its own filter commands. If you decide to use PQ for steps 1 to 3, it would be relatively simple for PQ to do this step as well.
    5) Once the desired timestamps are extracted, it is a simple subtraction step (as you show in your sample worksheet) to get the duration. All three programming languages (worksheet function, VBA, PQ) should have no trouble with this step.

    At this point, you need to decide if you must use VBA for this, or if you are allowed to use any programming language that will get the job done. Then examine your data to see if there are any complicating issues that are not represented in your sample file. Then we can work on programming the solution.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  6. #6
    Registered User
    Join Date
    02-08-2014
    Location
    Chennai
    MS-Off Ver
    Excel office 365
    Posts
    41

    Re: Reg:macro to find the downtime correlation.

    Quote Originally Posted by anavarathan View Post
    Thanks for your kind support

    is it possible to change this formula to work in excel 2016 or could please provide me vba script that can work in excel 2016.

    sorry for inconveience i am unable to change the excel verision in this forum.


    Please Login or Register  to view this content.
    Can you please help me to get same with IP address instead of server name.

    new.xlsx
    Last edited by anavarathan; 02-22-2024 at 10:44 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Correlation formula directly from correlation matrix
    By Phil123456789 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 08-18-2020, 05:35 AM
  2. Average correlation among stocks whose correlation are between 20% and 70%
    By sara_0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-01-2020, 06:13 AM
  3. [SOLVED] Find Correlation between 2 items in Excel
    By Smoke922 in forum Excel General
    Replies: 18
    Last Post: 02-12-2019, 01:58 PM
  4. Replies: 1
    Last Post: 08-17-2018, 07:30 PM
  5. 2 VBA macro's in correlation
    By raffi123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-24-2013, 04:09 AM
  6. How do i find a correlation between 2 data point or sets?
    By autologus in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-13-2006, 03:10 PM
  7. [SOLVED] Can i find Spearman's correlation number with excel?
    By james in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-23-2005, 09:06 PM

Tags for this Thread

Bookmarks

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