LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Formula to VBA function (if and lookup)

I am trying to turn this formula into a VBA function (this formula works
fine, but I have some other IF's I need to add that will take it over the
limit of 7):
=IF(R44="nc","",IF(R44="jcn","",IF(R44="wce","",IF (R44="cnd","",IF(R44="no
spare",(LOOKUP(Q44,WUC!A:A,WUC!D:D)),IF(R44="spare ",(LOOKUP(Q44,WUC!A:A,WUC!D:D))))))))



So far I have this:

Function Narrative(Reason As Range, Alias As Range)
If Reason = "nc" Then
Narrative = ""
ElseIf Reason = "jcn" Then
Narrative = ""
ElseIf Reason = "wce" Then
Narrative = ""
ElseIf Reason = "cnd" Then
Narrative = ""
ElseIf Reason = "rfs" Then
Narrative = ""
Else

After the else I want the Lookup part of the formula -
(LOOKUP(Q44,WUC!A:A,WUC!D:D), but I can't get it to work. The alias as
defined above is what I want the Lookup formula to look up in the other sheet.

Any suggestions will be greatly appreciated, I'm very new to VBA code.
Thanks!
 
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
LOOKUP FUNCTION? (LOOKUP VALUE BEING A TIME RENERATED FROM A FORMU JCC Excel Discussion (Misc queries) 5 June 26th 09 09:15 PM
Can I create a multiple LOOKUP formula with 'then' function??? Matthew Cardiff Excel Worksheet Functions 8 October 19th 07 11:23 AM
Whats better Lookup or Function Formula Jocko_MacDuff116 Excel Worksheet Functions 3 September 21st 07 04:32 PM
I need to use a lookup function in an if formula. Excluxe Excel Discussion (Misc queries) 1 July 9th 07 10:48 PM
Array Formula Using LOOKUP function. luchshel Excel Worksheet Functions 9 June 4th 07 07:32 PM


All times are GMT +1. The time now is 12:42 PM.

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"