PC Review


Reply
Thread Tools Rate Thread

Conditional Formatting based on active Named Range; IF Function to VBA

 
 
Todd
Guest
Posts: n/a
 
      1st Dec 2011
Hey,
I have more than 3 conditional formatting and I have more than 3 IF
statements in the function - I have 4. The function for four IF
statements in my case is listed below. How would I write this as a
VBA function?

I have numbers in column A, I have to identify, based off 4 active
named ranges, who the numbers belong to. For example, if the number
in A3 is 9004, the function/code would lookup up and find 9004 under
the active named range called SEA_ID and then would put in the B3
column SEA.

Any ideas are welcomed, thank you. Bull

=IF(COUNTIF(SEA_ID,A3),"SEA",IF(COUNTIF(SPO_ID,A3),"SPO",IF(COUNTIF(BUT_ID,A3),"BUT",IF(COUNTIF(ANC_ID,A3,"ANC",""))))

 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      1st Dec 2011
On Dec 1, 1:28*pm, Todd <bull...@gmail.com> wrote:
> Hey,
> I have more than 3 conditional formatting and I have more than 3 IF
> statements in the function - I have 4. *The function for four IF
> statements in my case is listed below. *How would I write this as a
> VBA function?
>
> I have numbers in column A, I have to identify, based off 4 active
> named ranges, who the numbers belong to. *For example, if the number
> in A3 is 9004, the function/code would lookup up and find 9004 under
> the active named range called SEA_ID and then would put in the B3
> column SEA.
>
> Any ideas are welcomed, thank you. Bull
>
> =IF(COUNTIF(SEA_ID,A3),"SEA",IF(COUNTIF(SPO_ID,A3),"SPO",IF(COUNTIF(BUT_ID, A3),"BUT",IF(COUNTIF(ANC_ID,A3,"ANC",""))))


suggest using select case. Look in vba help
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:33 AM.