+ Reply to Thread
Results 1 to 8 of 8

Convert wind direction to degrees

  1. #1
    Larry
    Guest

    Convert wind direction to degrees

    I'm sure this is a simple problem but I'm stupid. I have a
    column with wind direction (N,NNE,NE...) and I need to convert
    it to a numerical representation (0,22.5,45...). The spreadsheet
    has about 20,000 rows so I need to automate this. I have a
    mental picture how this needs to happen but I have no idea of
    the syntax necessary.

    Set a counter
    Read a cell
    If cell is empty quit
    Select Case statement
    Assign degree value to variable
    Write variable to adjacent cell
    Increment counter
    Do again

    Can anyone out there help me get started. I can get the select
    statements but I have no idea how to programatically read and
    write to cells.

    Thanks,
    Larry

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Use this function:

    Please Login or Register  to view this content.
    Usage:
    In cell A1 you have the direction, say NE.
    In cell B1, enter the following function to get the degree.
    =ConvToDegrees(A1)

    Note: The above code has to be entered in a new module.

    Mangesh

  3. #3
    Rowan
    Guest

    RE: Convert wind direction to degrees

    Larry

    Your best bet is to set up the Wind Directions on a seperate sheet as follows:

    COL A COL B
    - -
    WindDir WindDeg
    N 0
    NNE 22,5
    NE 45
    ENE 67.5
    .... ...

    And then just use a Vlookup worksheet function to get the degrees - see
    funcion help if you are unfamiliar with vlookups.

    Regards
    Rowan

    "Larry" wrote:

    > I'm sure this is a simple problem but I'm stupid. I have a
    > column with wind direction (N,NNE,NE...) and I need to convert
    > it to a numerical representation (0,22.5,45...). The spreadsheet
    > has about 20,000 rows so I need to automate this. I have a
    > mental picture how this needs to happen but I have no idea of
    > the syntax necessary.
    >
    > Set a counter
    > Read a cell
    > If cell is empty quit
    > Select Case statement
    > Assign degree value to variable
    > Write variable to adjacent cell
    > Increment counter
    > Do again
    >
    > Can anyone out there help me get started. I can get the select
    > statements but I have no idea how to programatically read and
    > write to cells.
    >
    > Thanks,
    > Larry
    >


  4. #4
    Larry
    Guest

    RE: Convert wind direction to degrees

    "=?Utf-8?B?Um93YW4=?=" <[email protected]>
    wrote in
    news:[email protected]:

    I read the function help but you didn't read the first line of
    my message. ;O} I've got what you indicated below on sheet2,
    a1:b16. I've got the wind dir in sheet1 column I. Column J is
    what I'm trying to populate. From what I can figure out I
    should have a cell somewhere on sheet1 with the following.
    =VLOOKUP(9,Sheet2!A1:B16,10,FALSE)
    That returns #N/A. What's up with that. I think I'm close but
    I just don't see it.

    Larry

    > Larry
    >
    > Your best bet is to set up the Wind Directions on a
    > seperate sheet as follows:
    >
    > COL A COL B
    > - -
    > WindDir WindDeg
    > N 0
    > NNE 22,5
    > NE 45
    > ENE 67.5
    > ... ...
    >
    > And then just use a Vlookup worksheet function to get the
    > degrees - see funcion help if you are unfamiliar with
    > vlookups.
    >
    > Regards
    > Rowan
    >
    > "Larry" wrote:
    >
    >> I'm sure this is a simple problem but I'm stupid. I have a
    >> column with wind direction (N,NNE,NE...) and I need to
    >> convert it to a numerical representation (0,22.5,45...).
    >> The spreadsheet has about 20,000 rows so I need to
    >> automate this. I have a mental picture how this needs to
    >> happen but I have no idea of the syntax necessary.
    >>
    >> Set a counter
    >> Read a cell
    >> If cell is empty quit
    >> Select Case statement
    >> Assign degree value to variable
    >> Write variable to adjacent cell
    >> Increment counter
    >> Do again
    >>
    >> Can anyone out there help me get started. I can get the
    >> select statements but I have no idea how to
    >> programatically read and write to cells.
    >>
    >> Thanks,
    >> Larry
    >>




    --
    Why, if aliens are smart enough
    to travel light years through
    space, do they keep abducting
    the dumbest people on earth?

  5. #5
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Larry,

    the inputs to the Vlookup function you are using are wrong. Suppose you have NE in cell A1, and you want the degree in cell B1, then enter the following in cell B1:
    =VLOOKUP(A1,Sheet2!$A$1:$B$16,2,FALSE)

    For blanks, you can modify the above function as follows:
    =If(A1="","",VLOOKUP(A1,Sheet2!$A$1:$B$16,2,FALSE))

    Copy down for all 20,000 rows.

    - Mangesh
    Last edited by mangesh_yadav; 03-03-2005 at 12:21 AM.

  6. #6
    Rowan
    Guest

    RE: Convert wind direction to degrees

    I hope you get this reply - it's been a while.

    Assuming your column with wind direction on sheet1 (main data sheet) is
    column F then in the column where you want the numerical representation you
    need the formual =VLOOKUP(F1,$A$1:$B$16,2,0)

    You could replace the 0 at the end with false - it is the same thing.

    Hope this helps
    Rowan

    "Larry" wrote:

    > I'm sure this is a simple problem but I'm stupid. I have a
    > column with wind direction (N,NNE,NE...) and I need to convert
    > it to a numerical representation (0,22.5,45...). The spreadsheet
    > has about 20,000 rows so I need to automate this. I have a
    > mental picture how this needs to happen but I have no idea of
    > the syntax necessary.
    >
    > Set a counter
    > Read a cell
    > If cell is empty quit
    > Select Case statement
    > Assign degree value to variable
    > Write variable to adjacent cell
    > Increment counter
    > Do again
    >
    > Can anyone out there help me get started. I can get the select
    > statements but I have no idea how to programatically read and
    > write to cells.
    >
    > Thanks,
    > Larry
    >


  7. #7
    Mangesh Yadav
    Guest

    RE: Convert wind direction to degrees

    Looks like queries answered in http://excelforum.com do not get
    reflected here. For instance, check the link for this thread:
    http://excelforum.com/showthread.php...nvert+wind+dir
    ection+degrees

    - Mangesh


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

  8. #8
    Mangesh Yadav
    Guest

    RE: Convert wind direction to degrees

    Sorry, I meant. When a query is answered through excelforum.com, they
    don't get reflected in developersdex.

    Mangesh

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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