Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Creating inout values for excel

I am doing a weather related project, and I need to enter wind data. How
would I be able to enter the wind direction "N" and have it display "0",
NNE=1, NE=2... up to 15 so that it is easier to run a regression analysis on?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Creating inout values for excel

Easiest way is via a vlookup

List the references into cols A and B in Sheet2
N 0
NNE 1
etc

Then in Sheet1,
if wind dir. data will be entered in A2 down, eg: NNE, N, etc
you could place this in B2:
=IF(A2="","",VLOOKUP(A2,Sheet2!A:B,2,0))
and copy B2 down as far as required
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:365 Subscribers:65
xdemechanik
---
"nelly007" wrote:
I am doing a weather related project, and I need to enter wind data. How
would I be able to enter the wind direction "N" and have it display "0",
NNE=1, NE=2... up to 15 so that it is easier to run a regression analysis on?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Creating inout values for excel

Yeah I thought of that but I really dont want to have cells for both a
direction and a value for that direction

"Max" wrote:

Easiest way is via a vlookup

List the references into cols A and B in Sheet2
N 0
NNE 1
etc

Then in Sheet1,
if wind dir. data will be entered in A2 down, eg: NNE, N, etc
you could place this in B2:
=IF(A2="","",VLOOKUP(A2,Sheet2!A:B,2,0))
and copy B2 down as far as required
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:365 Subscribers:65
xdemechanik
---
"nelly007" wrote:
I am doing a weather related project, and I need to enter wind data. How
would I be able to enter the wind direction "N" and have it display "0",
NNE=1, NE=2... up to 15 so that it is easier to run a regression analysis on?

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Creating inout values for excel

So you want to type NNE in a cell and have it change in-cell to a number?

You can do that with event code but how will you error-check your input?

Here is sheet event code to change in-cell as you enter but I think you're
looking for trouble with no way to cross-check entries.

Edit vals and nums arrays for more values. I just posted 10

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:A100")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
vals = Array("N", "NE", "NW", "NNE", "NNW", "S", "SE", "SW", "SSE", "SSW")
nums = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
For Each rr In r
ival = 0
For i = LBound(vals) To UBound(vals)
If UCase(rr.Value) = vals(i) Then
ival = nums(i)
End If
Next
If ival 0 Then
rr.Value = ival
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Wed, 10 Dec 2008 16:43:01 -0800, nelly007
wrote:

Yeah I thought of that but I really dont want to have cells for both a
direction and a value for that direction

"Max" wrote:

Easiest way is via a vlookup

List the references into cols A and B in Sheet2
N 0
NNE 1
etc

Then in Sheet1,
if wind dir. data will be entered in A2 down, eg: NNE, N, etc
you could place this in B2:
=IF(A2="","",VLOOKUP(A2,Sheet2!A:B,2,0))
and copy B2 down as far as required
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:365 Subscribers:65
xdemechanik
---
"nelly007" wrote:
I am doing a weather related project, and I need to enter wind data. How
would I be able to enter the wind direction "N" and have it display "0",
NNE=1, NE=2... up to 15 so that it is easier to run a regression analysis on?


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Creating inout values for excel

Gord,

How do I get "N" to return as zero in your sub?

--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:365 Subscribers:65
xdemechanik
---
"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
So you want to type NNE in a cell and have it change in-cell to a number?

You can do that with event code but how will you error-check your input?

Here is sheet event code to change in-cell as you enter but I think you're
looking for trouble with no way to cross-check entries.

Edit vals and nums arrays for more values. I just posted 10

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:A100")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
vals = Array("N", "NE", "NW", "NNE", "NNW", "S", "SE", "SW", "SSE", "SSW")
nums = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
For Each rr In r
ival = 0
For i = LBound(vals) To UBound(vals)
If UCase(rr.Value) = vals(i) Then
ival = nums(i)
End If
Next
If ival 0 Then
rr.Value = ival
End If
Next
End Sub


Gord Dibben MS Excel MVP





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Creating inout values for excel

Hi Max

Change the ival initial value and re-define nums array.

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:A100")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
vals = Array("N", "NE", "NW", "NNE", "NNW", "S", "SE", "SW", "SSE", "SSW")
nums = Array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
For Each rr In r
ival = -1
For i = LBound(vals) To UBound(vals)
If UCase(rr.Value) = vals(i) Then
ival = nums(i)
End If
Next
If ival -1 Then
rr.Value = ival
End If
Next
End Sub


Gord

On Thu, 11 Dec 2008 18:30:24 +0800, "Max" wrote:

Gord,

How do I get "N" to return as zero in your sub?


  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 272
Default Creating inout values for excel

If you don't want the values on the sheet you could use a defined name
formula for a regression variable:

DirNum:
=MATCH(WindDir,{"N";"NNE";"NE";"ENE";"E";"ESE";"SE ";"SSE";"S";"SSW";"SW";"WSW";"W";"WNW";"NW";"NNW"} ,0)-1

where WindDir is the range of values.

Then use in the formula eg: =LINEST(y_Values,DirNum,,1)
or if you are using more than one variable, you can use the syntax:
=LINEST(y_Values,CHOOSE({1,2,3},DirNum,x2_Values,x 3_Values),,1)



"nelly007" wrote:

Yeah I thought of that but I really dont want to have cells for both a
direction and a value for that direction

"Max" wrote:

Easiest way is via a vlookup

List the references into cols A and B in Sheet2
N 0
NNE 1
etc

Then in Sheet1,
if wind dir. data will be entered in A2 down, eg: NNE, N, etc
you could place this in B2:
=IF(A2="","",VLOOKUP(A2,Sheet2!A:B,2,0))
and copy B2 down as far as required
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:365 Subscribers:65
xdemechanik
---
"nelly007" wrote:
I am doing a weather related project, and I need to enter wind data. How
would I be able to enter the wind direction "N" and have it display "0",
NNE=1, NE=2... up to 15 so that it is easier to run a regression analysis on?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a list of cell values Link New Users to Excel 3 February 14th 08 09:32 AM
Creating a link from cell values Capp Excel Discussion (Misc queries) 8 May 8th 06 11:09 PM
Creating a chart from a table of values hydro1guy Charts and Charting in Excel 1 April 5th 06 06:42 PM
Creating an EXCEL COUNTIF formula for a range of values Pat Walsh Excel Discussion (Misc queries) 5 January 21st 05 02:57 PM
Creating a chart with values from two columns Ivan Charts and Charting in Excel 2 December 12th 04 07:31 PM


All times are GMT +1. The time now is 03:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"