+ Reply to Thread
Results 1 to 4 of 4

Move data between cells based on value of another cell

  1. #1
    Registered User
    Join Date
    03-30-2009
    Location
    Tennessee
    MS-Off Ver
    Excel 2003
    Posts
    1

    Move data between cells based on value of another cell

    I have a spreadsheet with columns z & aa that have numeric data. I would like to switch the data between the 2 cells if column ai has a value of "s". Can anyone help?

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Move data between cells based on value of another cell

    If it's going to be a "one-time" thing and you just need to do the switches in one shot only...then try this...

    Assuming your data has headers...

    in a new column, row 2 add formula =IF(AI2="s",AA2,Z2)

    and in another adjacent new column, row 2 =IF(AI2="s",Z2,AA2)

    where data starts in row 2.

    Then copy these down...

    Then copy the 2 new columns and go to Z1.

    Go to Edit|Paste Special and select Values.

    Click Ok.

    Now you can delete those 2 new columns added.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    03-27-2009
    Location
    Alcossebre, Spain
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Move data between cells based on value of another cell

    Hi

    You could try this

    Code:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Column = 35 And Cells(Target.Row, 35) = "s" Then
    a = Cells(Target.Row, 26): Cells(Target.Row, 26) = Cells(Target.Row, 27): Cells(Target.Row, 27) = a
    End If
    End Sub

    Code:

    Regards

    Colin

  4. #4
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Move data between cells based on value of another cell

    ColinKJ,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ 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