+ Reply to Thread
Results 1 to 3 of 3

IF(AND)) function: condition is part of another cell's value

  1. #1
    Registered User
    Join Date
    09-14-2008
    Location
    Virginia
    Posts
    6

    IF(AND)) function: condition is part of another cell's value

    Hi,

    I'm trying to do a fancy find-and-replace, basically. I want something that does the following:

    If A1 contains "Lewis" and B1 contains "CA" then change C1 to "41" else leave C1 the same as it was.

    Any help would be much appreciated.

    Thank you.

    -H

  2. #2
    Forum Expert
    Join Date
    12-24-2004
    Location
    Sweden
    Posts
    1,256
    Here are a few options:
    1. The easiest is to put this in D1:
    =IF(AND(A1="Lewis",B1="CA"),"41",C1).
    2. If the formula must be in C1, then the formula has to include the value already in C1.
    3. If non of the above is good enough, ask for help in the programming forum
    //Ola

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525
    Hi there,

    A non-macro solution would be to put the following formula into the first cell of a column that isn't part of your dataset (say D1) and copy down as required...

    =IF(AND(A1="Lewis",B1="CA"),41,C1)

    ...and then convert the formula range (or the entire column) to values and move / cut it (Ctrl + X) over Column C (Ctrl + V).

    If you do require a macro, running the following on the tab where the data resides should suffice:

    Please Login or Register  to view this content.
    HTH

    Robert

+ 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. Macro to Lock cells in protected sheet depending on criteria
    By Zyphon in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-30-2008, 12:00 PM
  2. Choose part of a cells value via formula
    By nimbo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-20-2007, 05:40 AM
  3. Replies: 6
    Last Post: 11-01-2007, 11:56 AM
  4. Colour in a range of cells if another cell changes condition
    By kingfisher in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-20-2007, 11:15 AM
  5. Move two cells up if condition met
    By Krzys in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-18-2007, 12:17 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