We’d like to remind Forumites to please avoid political debate on the Forum.
This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
Excel Code Query
 
            
                
                    Cotta                
                
                    Posts: 3,667 Forumite                
            
                        
                
                                    
                                  in Techie Stuff             
            
                    Hi All,
I have the following code in Excel, it basically look for a code and returns a separte value in an accompanying spreadsheet. However in front of this doe I want to include something to reflect that if cell A1 contains the word "Liverpool" then I want the word "Liverpool" returned instead of the below function being carried out. How do I do this?
=VLOOKUP(B2,'Q\Folder\Football\[Codes.xlsx]Sheet1'!$A$1:$G$670,7,FALSE)
Thanks
                I have the following code in Excel, it basically look for a code and returns a separte value in an accompanying spreadsheet. However in front of this doe I want to include something to reflect that if cell A1 contains the word "Liverpool" then I want the word "Liverpool" returned instead of the below function being carried out. How do I do this?
=VLOOKUP(B2,'Q\Folder\Football\[Codes.xlsx]Sheet1'!$A$1:$G$670,7,FALSE)
Thanks
0        
            Comments
- 
            Changing your formula to the following will probably do it:-
 =if(b2="Liverpool","Liverpool",VLOOKUP(B2,'Q\Folder\Football\[Codes.xlsx]Sheet1'!$A$1:$G$670,7,FALSE)):wall: Flagellation, necrophilia and bestiality - Am I flogging a dead horse? :wall:
 Any posts are my opinion and only that. Please read at your own risk.0
- 
            Perfect - thanks.0
- 
            What do you mean by "contains" - if you mean that it exactly matches then rmg1's code is perfect. If you mean that it should also match "Liverpool FC", or "I hear Liverpool are rubbish" then:
 IF(ISERR(FIND("Liverpool", B2)), LOOKUP..., "Liverpool")
 Will find the substring "Liverpool" anywhere within B2.
 Mirno0
- 
            What do you mean by "contains" - if you mean that it exactly matches then rmg1's code is perfect. If you mean that it should also match "Liverpool FC", or "I hear Liverpool are rubbish" then:
 IF(ISERR(FIND("Liverpool", B2)), LOOKUP..., "Liverpool")
 Will find the substring "Liverpool" anywhere within B2.
 Mirno
 Could also use SEARCH, as FIND is case sensitive.0
- 
            What do you mean by "contains" - if you mean that it exactly matches then rmg1's code is perfect. If you mean that it should also match "Liverpool FC", or "I hear Liverpool are rubbish" then:
 IF(ISERR(FIND("Liverpool", B2)), LOOKUP..., "Liverpool")
 Will find the substring "Liverpool" anywhere within B2.
 Mirno
 Hey, less of the Liverpool are rubbish 
 Thanks to all for your feedback.0
This discussion has been closed.
            Confirm your email address to Create Threads and Reply
 
Categories
- All Categories
- 352.2K Banking & Borrowing
- 253.6K Reduce Debt & Boost Income
- 454.3K Spending & Discounts
- 245.3K Work, Benefits & Business
- 600.9K Mortgages, Homes & Bills
- 177.5K Life & Family
- 259.1K Travel & Transport
- 1.5M Hobbies & Leisure
- 16K Discuss & Feedback
- 37.7K Read-Only Boards
 
          
         