+ Reply to Thread
Results 1 to 9 of 9

condition formula performing actions on different columns

  1. #1
    Registered User
    Join Date
    08-08-2014
    Location
    Here and There
    MS-Off Ver
    2010
    Posts
    25

    condition formula performing actions on different columns

    Hi,
    I have the following problem. Please see the attached file.
    C column contains some vlookup formula. for some cells it founds the value, and for other it shows N/A.
    I need the followng formula on D2 (and the rest of the column)- if C2 is N/A, don't do anything, otherwise change the value in B2 to "green".

    I can't use the IF, because it does not allow to refer to a different column.

    Will appreciate your help.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: condition formula performing actions on different columns

    Copy and past this formula in B2 and fill down?
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Is this what you mean?

  3. #3
    Registered User
    Join Date
    08-08-2014
    Location
    Here and There
    MS-Off Ver
    2010
    Posts
    25

    Re: condition formula performing actions on different columns

    Thanks, but not exaclty, as I need B2 to stay with the origianl value if it's false. You have put "blue", but this is just an exmaple, and there might be different values there, not only blue. So is it's not NA, I need the B2 to be not touched.

  4. #4
    Valued Forum Contributor
    Join Date
    08-04-2011
    Location
    UK
    MS-Off Ver
    Excel 2021
    Posts
    346

    Re: condition formula performing actions on different columns

    you can use conditional formatting

    test.xlsx

  5. #5
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: condition formula performing actions on different columns

    You can try this macro, however it requires a bonus column (column D in this case) with this formula dragged down =ISNA(C2)
    Adjust EndNumber value depending on the lenghth of your list

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

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: condition formula performing actions on different columns

    When you say B2 to be untouched..........if the value remained the same but conditional formatting as AlanY has suggested could coerce B2 to display "green" without touching it's underlying value,....would that work?

  7. #7
    Registered User
    Join Date
    08-08-2014
    Location
    Here and There
    MS-Off Ver
    2010
    Posts
    25

    Re: condition formula performing actions on different columns

    Thanks.
    What if use the same macro each time for different number of raws. What would I put in the EndNumber?

  8. #8
    Registered User
    Join Date
    08-08-2014
    Location
    Here and There
    MS-Off Ver
    2010
    Posts
    25

    Re: condition formula performing actions on different columns

    conditional formating wont work. I need for some cells to actually change the value (as I am going to do something with it) and some cell to stay with the value which was there before.

  9. #9
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: condition formula performing actions on different columns

    Quote Originally Posted by niukvba View Post
    Thanks.
    What if use the same macro each time for different number of raws. What would I put in the EndNumber?
    The EndNumber is used to determine how many rows the macro has to process. In this case, your example had 8 rows of data, so EndNumber=8. If your data range has 500 rows, EndNumber=500, otherwise the macro will process only a part of the data range.

+ 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. Need assistance on inserting a condition before performing an action
    By raghunkumar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-08-2013, 12:35 PM
  2. Replies: 5
    Last Post: 09-07-2013, 03:57 AM
  3. Replies: 9
    Last Post: 07-27-2013, 01:59 PM
  4. Need help: two columns and a table of actions
    By Labellavita in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 03-18-2013, 07:34 PM
  5. [SOLVED] Performing actions on multiple worksheets
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2005, 11:06 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