ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   numbers to text function (https://www.excelbanter.com/excel-worksheet-functions/16593-numbers-text-function.html)

John T. Sheedy

numbers to text function
 
I have a list of numbers 0-35 that I have to convert to 8 compass
directions(N, NW, E, ECT.). I used the IF function to search but the string
doesnt work. I tried using an array {1,2,3,33,34,35} for north and it comes
back as false even thought the search number is 35

This is a sample of the finction I am using

=IF(A5={0,1,2,33,34,35},"N",IF(A5={3,4,5,6,},"NE", "NW"))
I carries this formula out to the 7 argument limet and am using the NW to
represent the last compass direction.

Please help

John

Bob Phillips

Create a lookup table of the form

0 N
3 NE
7 E
10 NW
....
33 N

that is just create an entry for the lowest number of each point (including
duplicating for N in 33, etc.), and assuming that tab le is ih H1:I10, use

=VLOOKUP(A5,$H$1:$I$10,2)

adjust the lookup range to suit


--

HTH

RP
(remove nothere from the email address if mailing direct)


"John T. Sheedy" <John T. wrote in message
...
I have a list of numbers 0-35 that I have to convert to 8 compass
directions(N, NW, E, ECT.). I used the IF function to search but the

string
doesnt work. I tried using an array {1,2,3,33,34,35} for north and it

comes
back as false even thought the search number is 35

This is a sample of the finction I am using

=IF(A5={0,1,2,33,34,35},"N",IF(A5={3,4,5,6,},"NE", "NW"))
I carries this formula out to the 7 argument limet and am using the NW to
represent the last compass direction.

Please help

John




Ron Rosenfeld

On Tue, 8 Mar 2005 01:43:03 -0800, "John T. Sheedy" <John T.
wrote:

I have a list of numbers 0-35 that I have to convert to 8 compass
directions(N, NW, E, ECT.). I used the IF function to search but the string
doesnt work. I tried using an array {1,2,3,33,34,35} for north and it comes
back as false even thought the search number is 35

This is a sample of the finction I am using

=IF(A5={0,1,2,33,34,35},"N",IF(A5={3,4,5,6,},"NE" ,"NW"))
I carries this formula out to the 7 argument limet and am using the NW to
represent the last compass direction.

Please help

John


Assuming, if I may, that the numbers you are using refer to the compass
direction in degrees divided by 10, then I believe your example is incorrect.

Shouldn't 33 equate to NW? NW = 315° so the dividing point between NW and N
should be at 315° + 22.5° or 337.5° or, in your "divide by 10" 33.75?

If that is the case, then the following formula should give you your desired
results (with your "number" in A1)

=HLOOKUP(A1,{0,2.25,6.75,11.25,15.75,20.25,24.75,2 9.25,33.75;"N","NE","E","SE","S","SW","W","NW","N" },2)

You may want to add an IF test to ensure a valid entry; or use data validation
to ensure the same.


--ron


All times are GMT +1. The time now is 11:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com