+ Reply to Thread
Results 1 to 13 of 13

Apply formulas to the end of data of varying length in columns(please see description)

  1. #1
    Registered User
    Join Date
    10-01-2012
    Location
    Romānia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Lightbulb Apply formulas to the end of data of varying length in columns(please see description)

    Hello !
    I have data of the storm climate in a region which includes season(year) ,the number of the storm , interval , direction and speed.
    I need to find out the resultant wind speed and directions of each storm.Only the last two columns will be used. Because there are aprox. 1100 storms to which i should apply 3 formulas , this is a very time consuming process .

    The procedure is like this :
    1) At the end of the last two columns at every storm, I must first calculate the average of the values above (which represent the rectangular coordinates)
    Average.jpg
    2) Then i must apply a formula =180/3.1415926*ATAN2(''Average Column 1'',''Average Column 2'') to receive the wind vector
    Direction.jpg
    3) In the end =SQRT(''Average Column 1''^''Average Column 2''^2)
    Speed.jpg

    To better understand the situation i attached some images and of course , the excel file.
    Storms 73-96.xlsxStorms 96-2012.xlsx(i split it in two because of the size)

    This must be done for each individual storm . I really wish there is a way to do this and I appreciate if i will recieve some solution.

    P.S. It's my first post , hope I have some good luck !

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,001

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Welcome to the forum.

    I would suggest that you repeat the storm number on each row to which it relates and lose the blank lines between the blocks of data. Add header data, like Storm, Date, Time, etc.

    You may then be able to use a Pivot Table to analyse the data but, failing that, you can use COUNTIF/S, SUMIF/S, AVERAGEIF/S and so on.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Try something like this...

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-01-2012
    Location
    Romānia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    YES ! It works like a charm ! you saved me tens of hours of work ! I am really excited because i can now apply this for other databases also.
    one thing , if the value is negative (like -55) I need to add 360 (so that it equals 305), what shoud i put in the code to do this?
    THANK YOU!

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Quote Originally Posted by Exorbit View Post
    YES ! It works like a charm ! you saved me tens of hours of work ! I am really excited because i can now apply this for other databases also.
    one thing , if the value is negative (like -55) I need to add 360 (so that it equals 305), what shoud i put in the code to do this?
    THANK YOU!
    You're welcome. Why is it that charms are never said to work like a macro? Doesn't seem fair.

    You could change the formula (whichever one) to something like...
    =formula + IF(formula<0,360,0)

    .Offset(2, 4).FormulaR1C1 = "=180/PI()*ATAN2(R[-1]C,R[-1]C[1])
    + IF(180/PI()*ATAN2(R[-1]C,R[-1]C[1])<0,360,0)"

  6. #6
    Registered User
    Join Date
    10-01-2012
    Location
    Romānia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Hello , sorry to disturb you again.
    Now I have to calculate the number of hours for each storm .
    1)First ,I need a macro to calculate the difference between the last and the first in the Date.time column for each storm.And please , I want it to be one cell after last value in the column.
    I attached an image to explain this.Attachment 191267
    2)Second , I need to calculate an index(and to do so I need another value for the Date.hour column) , so in the cell that is left blank i need to put this formula :Last cell + Last cell - The cell before the last cell. Again i attached an image .Attachment 191268

  7. #7
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    How did the last formula change work out for you?

    Your recent images did not attach.

  8. #8
    Registered User
    Join Date
    10-01-2012
    Location
    Romānia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Post Re: Apply formulas to the end of data of varying length in columns(please see description)

    The last formula worked perfectly !
    I didn't noticed that the images didn't display . Now i changed the method a bit.
    1)I need to calculate the difference between the last Cell and the first in the column Date.time , at the end of it , for each storm.
    Total hours.jpg
    2)At the bottom of each column i need this : Last cell+Last cell - the cell before the last cell (F22+F22-F21), again for each storm.
    Last value.jpg(i made a mistake , i should have renamed the column other than Date.time , but doesn't matter really. (this is for knowing the time step , that is used for an index - SIF (Storm impact factor))


    Thank you , and I really need to learn to do macros in excel to not have to take your time.

  9. #9
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    The data in your recent images isn't the same configuration as you original data file. Can you provide a new data file?

  10. #10
    Registered User
    Join Date
    10-01-2012
    Location
    Romānia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Storms2.xlsx
    Oh , sorry that I forgot about it . Here it is!

  11. #11
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    10-01-2012
    Location
    Romānia
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Yes it's perfect! Thank you a lot ! , One other question(and I hope it will be my last) how can I select every last cell with values before a blank cell in a column?

  13. #13
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,651

    Re: Apply formulas to the end of data of varying length in columns(please see description)

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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