+ Reply to Thread
Results 1 to 5 of 5

Partial IF matches (possibly nested)

  1. #1
    Registered User
    Join Date
    01-14-2015
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    3

    Partial IF matches (possibly nested)

    Hey guys,

    I'm trying to get a partial match IF statement that checks the first two characters of a cell (likely to be numbers), and if it matches a certain string put information from another cell into the first cell.

    (Explanation, I'm a network admin, making a configuration template. If the hostname entered into Cell A4 starts with say "02" for Sydney, put the Sydney username and password (defined in cell B17) into A7 (where this formula is), if it starts with 04 for Perth, put the username/password in B18 into A7... etc etc)

    Thanks for any help!

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,463

    Re: Partial IF matches (possibly nested)

    Do you have several 2-letter codes? If so, then you can use VLOOKUP, making use of a table of those codes and meanings (username/password) elsewhere on the sheet. Suppose you put that table in columns X and Y, and the cell that you want to test is A4 - then you can use this formula in B4:

    =IFERROR(VLOOKUP(LEFT(A2,2),$X:$Y,2,0),"not found")

    then copy down as required.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    01-14-2015
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    3

    Re: Partial IF matches (possibly nested)

    I think this is close to what I'm looking for =IFERROR(VLOOKUP(LEFT('Info sheet'!B8,2),'Location Codes'!A1:A69,2,TRUE),"not found"), but my columns of matching codes with passwords on the next sheet isn't firing, and all I get is 'not found'

  4. #4
    Registered User
    Join Date
    01-14-2015
    Location
    Melbourne
    MS-Off Ver
    2010
    Posts
    3

    Re: Partial IF matches (possibly nested)

    Ah, got it! I wasn't checking the 2nd column properly

    =IFERROR(VLOOKUP(LEFT('Info sheet'!B8,2),'Location Codes'!A1:B69,2,TRUE),"not found")

    Thanks Pete, you sir, are a legend!

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,463

    Re: Partial IF matches (possibly nested)

    If you are going to copy that formula down, you will need to make your table references absolute, i.e. $A$1:$B$69 instead of A1:B69.

    Hope this helps.

    Pete

    P.S. If that takes care of your original question, please select Thread Tools from the menu above your first post and mark this thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of a post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. COUNTIFS issue - Returns zero matches (possibly wrong formula???)
    By sx200n in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-22-2014, 08:09 AM
  2. Hairy nested IF, possibly MAX involved?
    By beccadoodles7 in forum Excel General
    Replies: 1
    Last Post: 11-07-2012, 06:24 AM
  3. Advanced Filter, nested =IF function, or possibly some other tricker *please help*
    By mmarshall in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-26-2008, 09:49 PM
  4. Replies: 1
    Last Post: 06-26-2008, 08:42 PM
  5. [SOLVED] Autofiltering for partial matches
    By PeterJordan in forum Excel General
    Replies: 1
    Last Post: 01-12-2006, 05:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1