+ Reply to Thread
Results 1 to 8 of 8

Issue building a lookup or if formula

  1. #1
    Registered User
    Join Date
    12-04-2014
    Location
    NY
    MS-Off Ver
    2010
    Posts
    3

    Issue building a lookup or if formula

    Hi All! I am new to this, so please let me know if I am not following any necessary due process.

    My question is as follows...

    I have a spreadsheet containing MANY addresses; each row is broken down by ADDRESS, CITY, STATE, and ZIP. I have an additional column (COUNTY) into which I would like to insert a formula that looks at the column containing the CITY for each address and compares it against a list on another sheet in the workbook that lists all of the city's in Delaware County. If the name of the city in the spreadsheet containing addresses is one of the 33 cities contained on the other sheet within the workbook, the formula should return "Delaware", if the city name is not one listed for Delaware county, the formula should return "other".

    In the end, I would like to be able to sort my data by the STATE, COUNTY, then CITY.

    Can anyone help?

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Issue building a lookup or if formula

    Welcome to the community Paul

    Please attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Issue building a lookup or if formula

    List the cities in one column and Delaware in the next column. Just as an example lets say the cities are on Sheet2 in column A from A2:A34 and Delaware is entered in B2 and copied down to B34.

    If the CITY column is column B on Sheet1 starting in the second row enter this formula in C2 and copy down.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Another common formula uses INDEX and MATCH but I think VLOOKUP is the easiest to understand when starting out.
    <---------If you like someone's answer, click the star to the left of one of their posts to give them a reputation point for that answer.
    Ron W

  4. #4
    Valued Forum Contributor
    Join Date
    01-10-2012
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    651

    Re: Issue building a lookup or if formula

    another option without putting "Delaware" in every row on your other sheet:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    (untested)

  5. #5
    Registered User
    Join Date
    12-04-2014
    Location
    NY
    MS-Off Ver
    2010
    Posts
    3

    Re: Issue building a lookup or if formula

    Thank you. Hopefully the sample document successfully uploads with this post.
    Attached Files Attached Files

  6. #6
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Issue building a lookup or if formula

    As Ron posted, VLOOKUP will be suffice.

    In G2 use,

    =IFERROR(VLOOKUP(D2,DelawareCounty!A:B,2,0),"Other")

    Then copy down.

  7. #7
    Registered User
    Join Date
    12-04-2014
    Location
    NY
    MS-Off Ver
    2010
    Posts
    3

    Re: Issue building a lookup or if formula

    FANTASTIC!!! Thank you so much everyone. The "=IFERROR(VLOOKUP..." formula worked perfectly, Haseeb. As I look at the formula though, I am not clear what the "2,0)" portion of the formula does. Can you break it down?

  8. #8
    Forum Expert newdoverman's Avatar
    Join Date
    02-07-2013
    Location
    Port Dover, Ontario, Canada
    MS-Off Ver
    2010
    Posts
    10,330

    Re: Issue building a lookup or if formula

    the ,2 means to look in the second column

    the ,0 means the match has to be exact.

+ 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. Lookup Formula Issue, Search issue
    By kperitz in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 04-07-2014, 01:50 PM
  2. [SOLVED] formatting issue with data ranges in chart building macro
    By dbiluk in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-26-2013, 07:53 AM
  3. Summing issue, require formula with lookup
    By Mattias1 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-22-2013, 02:43 PM
  4. Replies: 2
    Last Post: 10-08-2012, 12:49 PM
  5. Building a lookup table with 3 variables/3 answers
    By Dannypak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2009, 12:12 PM

Tags for this Thread

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