+ Reply to Thread
Results 1 to 3 of 3

Formula to insert value depending on previous field

  1. #1
    Registered User
    Join Date
    01-19-2014
    Location
    West Nyack, NY
    MS-Off Ver
    Excel 2010
    Posts
    5

    Formula to insert value depending on previous field

    I have what should be a simple formula need.

    In column A, there are sites
    Philadelphia
    York
    Pittsburg

    In column B, there are last names
    Smith
    Jones
    Williams

    In Column C, I have a formulas that displays a result based on column A and B

    If Column A [EQUALS EITHER] Philadelphia or York.....
    Then Column C should be changed to "Eastern Pennsylvania"

    ELSE..... column C should return the value displayed in column B.


    Sample
    Philadelphia - Smith
    York - Jones
    Pittsburg - Williams

    I would expect Philadelphia - Smith to read 'Eastern Pennsylvania"
    I would expect York - Jones to read 'Eastern Pennsylvania"
    I would expect Pittsburg - Williams to read 'Williams"

    I can't figure out whether there is a way to do an OR statement within the IF statement, or whether a lookup table would be best.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    81,594

    Re: Formula to insert value depending on previous field

    In C1, copied down:

    =IF(OR(A1="Philadelphia",A1="York"),"Eastern Pennsylvania",B1)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    01-19-2014
    Location
    West Nyack, NY
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Formula to insert value depending on previous field

    I knew I was overcomplicating this. This worked like a charm. Thank you!!!

+ 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. Insert formula depending on cells depending of variables
    By elmexicano87 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-29-2014, 01:22 PM
  2. Macro to insert variable formula depending on sheet name
    By Burt_100 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2013, 03:22 PM
  3. [SOLVED] Insert 0 at beginning of field depending on no of characters
    By enna1949 in forum Excel General
    Replies: 5
    Last Post: 12-27-2012, 03:51 AM
  4. [SOLVED] Code to insert formula depending on CheckBox Selection
    By gautamacharya in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2012, 06:47 PM
  5. How to format field depending on another field?
    By jgomez in forum Access Tables & Databases
    Replies: 7
    Last Post: 03-29-2012, 11:42 AM

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