Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default relative reference

Hi,

wondering if anyone can help me with this formula.

i have one cell in worksheet. i want to extract a word (text) and i
the next column based on "text" i want to assign a description to it.
have used following, but giving me an error.

Function productname()
Dim ProductID As String
Dim x As String
Dim y As String

x = ActiveCell.Offset(0, -1)

Select Case y
Case y = "xyz"
If (IsError(Find(y, x))) Then
ProductID = "ENC"
Else
ProductID = "xoyazer"
End If
Case y = "VOY"
If (IsError(Find(y, x))) Then
ProductID = "ENC"
Else
ProductID = "xoyager1"
End If
End Select


End Function

thanks

ni

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default relative reference

IsError and Find are worksheet Functions and you cannot call in that way in
VBA. And you don't restate the selevct value in the Case statement

And where does y get set to a value? Assuming it gets set somewhere, try
this

Function productname()
Dim ProductID As String
Dim x As String
Dim y As String

x = ActiveCell.Offset(0, -1)

Select Case y
Case "xyz"
If Evaluate("IsError(Find(""" & y & """," & x & "))") Then
ProductID = "ENC"
Else
ProductID = "xoyazer"
End If
Case "VOY"
If Evaluate("IsError(Find(""" & y & """," & x & "))") Then
ProductID = "ENC"
Else
ProductID = "xoyager1"
End If
End Select

End Function

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"nix2004 " wrote in message
...
Hi,

wondering if anyone can help me with this formula.

i have one cell in worksheet. i want to extract a word (text) and in
the next column based on "text" i want to assign a description to it. i
have used following, but giving me an error.

Function productname()
Dim ProductID As String
Dim x As String
Dim y As String

x = ActiveCell.Offset(0, -1)

Select Case y
Case y = "xyz"
If (IsError(Find(y, x))) Then
ProductID = "ENC"
Else
ProductID = "xoyazer"
End If
Case y = "VOY"
If (IsError(Find(y, x))) Then
ProductID = "ENC"
Else
ProductID = "xoyager1"
End If
End Select


End Function

thanks

nix


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default relative reference

thanks for your response!

i am still getting 0 in the cell value. i will try to explain i
detail.

Column A
VOY-CCC
Xyz-alpha from Eastern
tera-abc morgan
etc.

i want to set up column B based on values from column A. i want t
define if it's VOY then it should be xoyager1, if it's xyz or anythin
else, it should be based on them. coumn A could be 15 lines, al
different product group, or could be 5 or 6. y is based on descriptio
from column A.

hope this helps.

ni

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default relative reference

why would it return value 0. is it cause not recognizing formula or ..
i tried following and it returns wrong value. not zero though.

If Evaluate("IsError(Find(""" & ENC & """, x))") Then
ProductID = "ENC"
Else
ProductID = "Voyager"
End I

--
Message posted from http://www.ExcelForum.com

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 an offset formula for the reference in a relative reference Cuda Excel Worksheet Functions 6 November 15th 06 05:12 PM
Relative Reference Hari Excel Discussion (Misc queries) 4 October 26th 05 02:00 AM
Relative Reference Barry Givens via OfficeKB.com Excel Discussion (Misc queries) 3 December 17th 04 07:31 PM
relative reference Charlie New Users to Excel 3 December 3rd 04 07:22 PM
relative reference Duce Excel Programming 1 October 24th 03 09:44 PM


All times are GMT +1. The time now is 01:28 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"