+ Reply to Thread
Results 1 to 4 of 4

Change one column's value based on input conditions.

  1. #1
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    3

    Change one column's value based on input conditions.

    Hi guys, I'm trying to write a macros where it changes the value of one column based on the input condition of the user.

    For example:

    InputBox A = 0.5
    InputBox B = 1.0

    Check the entire column A, if value of column A is >= 0.5 AND value of column A is <= 1.0, Then change Column B value to 1. If NOT, Do NOTHING.

    Greatly appreciate your experts help.

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,946

    Re: Change one column's value based on input conditions.

    you dont need a macro for this, a formula will do it easily...

    in B1 use this =if(and(A1>=0.5,A1<=1),1,"")

    if B already has values, you coulds put this in C1 and change it to...
    =if(and(A1>=0.5,A1<=1),1,B1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Change one column's value based on input conditions.

    Thank you FDibbins for your suggestion.

    However, I need to make this change for 20 different excel files along with different conditions for each of them.

    Also column B's original values cannot be changed if it doesn't meet the condition. Making a separate column C1 won't solve the problem.

  4. #4
    Registered User
    Join Date
    11-30-2012
    Location
    United States
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Change one column's value based on input conditions.

    Here is some code I piece together after reading some forum helps.

    I'm stuck at the part where I have met the condition, I need to change to the exact same corresponding B1 cell to value of "1"

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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