+ Reply to Thread
Results 1 to 6 of 6

change cell values based on criteria

  1. #1
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Budapest
    MS-Off Ver
    Excel 2010
    Posts
    155

    change cell values based on criteria

    I would like to ask for your help solving one of my problems.
    In a database I have to change the cell values which meets the criteria defined.

    In the sample file I attached there is "sheet1" where in A2 contains a value and B2, C2 contains two criteria which define a time range.
    In sheet "database" I should change all values to "Q" in range BB4:BB15000 where
    rows in range D4:D15000 meets criteria defined in Sheet1 A2
    and are in the interval in range AD4:AD15000 defined the Sheet1 B2 and C2 value.
    Attached Files Attached Files
    Last edited by ccsmith; 10-26-2011 at 09:51 AM.

  2. #2
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: change cell values based on criteria

    - enter a date in sheet1!B2 : 01-10-2011
    - enter a date in sheet1!C2 : 31-10-2011

    use a formula in column BB:

    PHP Code: 
    =CHOOSE(($D4=Sheet1!$A$2)*($AD4>Sheet1!$B$2)*($AD4<Sheet1!$C$2)+1;"";"Q"
    NB replace the ; into , if necessary
    Last edited by snb; 10-26-2011 at 07:48 AM.



  3. #3
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Budapest
    MS-Off Ver
    Excel 2010
    Posts
    155

    Re: change cell values based on criteria

    snb: thank you for your solution but I would need a macro for this problems, beacuse I need to run the routin just in some case.
    However the function change all value and my database can contains just values not formulas.
    I need to change the data which meet the critera other data could be untouched.
    In the sample file according to the critzerias just cells BB4; BB17; BB23 should change to "Q" the rest ones must be untouched.
    Your idea isn a great basepoint. Do you have an option for this problem with a VBA code?

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: change cell values based on criteria

    You could have adapted the formula yourself:

    PHP Code: 
    =CHOOSE(($D4=Sheet1!$A$2)*($AD4>Sheet1!$B$2)*($AD4<Sheet1!$C$2)+1;BB4;"Q"

  5. #5
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: change cell values based on criteria

    ..And could have used it for the VBA-approach:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    04-21-2010
    Location
    Budapest
    MS-Off Ver
    Excel 2010
    Posts
    155

    Re: change cell values based on criteria

    Simply but brilliant solution. Many thanks for your effort.

+ 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