#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Operator

i have a spreadsheet where one column lists location codes. There are 20
different codes that are in the US. I want to create a formula that says if
location code is one of these, it is equal to US. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 772
Default Operator

You can do a Vlookup, if the numbers that are in the us are in column A and
the number you are testing is in G then
=IF(ISERROR(VLOOKUP(G1,A1:A31,1,FALSE)),"Other","U SA")
or did you want to do this strictly through code?
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"kittycris" wrote:

i have a spreadsheet where one column lists location codes. There are 20
different codes that are in the US. I want to create a formula that says if
location code is one of these, it is equal to US. Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Operator

Thank you! How would I do this through code?

"John Bundy" wrote:

You can do a Vlookup, if the numbers that are in the us are in column A and
the number you are testing is in G then
=IF(ISERROR(VLOOKUP(G1,A1:A31,1,FALSE)),"Other","U SA")
or did you want to do this strictly through code?
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"kittycris" wrote:

i have a spreadsheet where one column lists location codes. There are 20
different codes that are in the US. I want to create a formula that says if
location code is one of these, it is equal to US. Thanks.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 93
Default Operator

Thought I posted this earlier, ask questions if you need help
Sub main()
Dim myArray(30, 1) As Long
Dim myIndex As Long
Dim myRow As Long
Dim myNum As Long

myNum = 4


For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row 'change i to first
'row and "A" to first column
myArray(i, 1) = Cells(i, 1)
myRow = myRow + 1
Next


For i = 1 To UBound(myArray)
MsgBox myArray(i, 1)
If myArray(i, 1) = myNum Then MsgBox "USA"
Next

End Sub

--
--
-John
Please rate when your question is answered to help us and others know what
is helpful.

"kittycris" wrote in message
...
Thank you! How would I do this through code?

"John Bundy" wrote:

You can do a Vlookup, if the numbers that are in the us are in column A
and
the number you are testing is in G then
=IF(ISERROR(VLOOKUP(G1,A1:A31,1,FALSE)),"Other","U SA")
or did you want to do this strictly through code?
--
-John Northwest11
Please rate when your question is answered to help us and others know
what
is helpful.


"kittycris" wrote:

i have a spreadsheet where one column lists location codes. There are
20
different codes that are in the US. I want to create a formula that
says if
location code is one of these, it is equal to US. Thanks.



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
Using Concatenate operator to overcome 7 nested IF's TG Excel Worksheet Functions 1 April 12th 06 10:40 PM
add one cell with no equals operator reggie26t Excel Discussion (Misc queries) 1 January 24th 06 02:57 PM
corrupt program or file? How to tell? Or is it operator error? [email protected] Excel Discussion (Misc queries) 6 January 17th 06 12:40 PM
SaveAS to a specific folder, with operator input of file name [email protected] Excel Discussion (Misc queries) 1 January 5th 06 03:19 PM
"OR" operator to evaluate multiple conditions anand Excel Worksheet Functions 1 May 23rd 05 08:49 PM


All times are GMT +1. The time now is 08:36 AM.

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

About Us

"It's about Microsoft Excel"