+ Reply to Thread
Results 1 to 10 of 10

If/Then statement to move section of column to different column and row

  1. #1
    Registered User
    Join Date
    01-16-2013
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    If/Then statement to move section of column to different column and row

    Can't figure out an if statement that will allow me to move the contents of a column over to another column but down a couple of rows based on the result of a logic statement in a third row. In other words, I have a column of data in row A and B. In row C I have just one number. I would like to create a column D with the following. If the data in column A row "x" is less than the single point in column C, then 0 in row "x" column D. If the data in column A becomes equal to or greater than the the number in column C, then I would like to take all the data in column B and move it over to column D starting at row "x".

    Sure would appreciate help. I've been knocking this around for a couple of weeks and can't figure out how to do it. Thanks.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: If/Then statement to move section of column to different column and row

    Hi

    something like

    D2: =IF(A2>=$C$1,B2,0)

    rylo

  3. #3
    Registered User
    Join Date
    01-16-2013
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: If/Then statement to move section of column to different column and row

    Hi Rylo,

    Thanks for your reply. That is what I started with but the "true" statement doesn't move the entire column over starting from the top. It looks like this
    ..................................D........................D
    A....B....C.....=IF((A2>=$C$1,B2,0)....what I want
    1....2....5.....................0.........................0
    2....5...........................0.........................0
    3....6...........................0.........................0
    4....8...........................0.........................0
    5....9...........................9.........................2
    6...........................................................5
    7...........................................................6
    8...........................................................8
    9...........................................................9

    If you have any idea how to move the entire column B over to Column D starting at the "true" value, I would be grateful.
    Last edited by everts; 01-17-2013 at 12:28 PM. Reason: numbers didn't come out right

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: If/Then statement to move section of column to different column and row

    Hi

    Not sure that I follow what you are chasing. You can't use a function to move an entire column, but you can copy the function down to all cells in the column to do the test and bring back the required value.

    How about you create an example file and give details on exactly what the output should look like for the given example data, and explain exactly how each result cell is determined.

    rylo

  5. #5
    Registered User
    Join Date
    01-16-2013
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: If/Then statement to move section of column to different column and row

    Thank you so much for trying to help me. I really appreciate it!

    Attached please find an example file. When my if/then statement for column D is true, what I want to do is copy a part of a column (the 5 lines of Column B in the example (B3 through B7), over to colmun D (in this example they should be at D7 through D11), starting at the row where A was equal to $C$3 (in this example at A7). (Column E has what I would like to have column D display).

    In other words, it would be great to have a statement such as .....=IF(A7>=$C$3,"X",0)where "X" will be B1. Then in the same column with the same formula copied one row down (A8>=$C$3,"X+1",0) where "X+1" will be B2, in the next row "X+2" will be B3, etc. I can put in the statement at D7, IF (A7>= $C$1,$B$1,0), but then how do I get D8 which will have a true statement to be B2 and D9 which will have a true statement to be B3, etc. when I copy the formula down? I have to either find a formula that can handle this or manually move this column over several hundred times...

    Hope this helps to clarify what I'm trying to achieve. Thanks again!
    Attached Files Attached Files

  6. #6
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: If/Then statement to move section of column to different column and row

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

    copy down

    Hope this helps

    Edit-
    Meant in D3, Not C3, sorry
    Last edited by dredwolf; 01-17-2013 at 07:39 PM.
    A picture may be worth a thousand words, BUT, a sample Workbook is worth a thousand screenshots!
    -Add a File - click advanced (next to quick post), scroll to manage attachments, click, select add files, click select files, select file, click upload, when file shows up at bottom left, click done (bottom right), click submit
    -To mark thread Solved- go top of thread,click Thread Tools,click Mark as Solved
    If you received helpful response, please remember to hit the * of that post

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: If/Then statement to move section of column to different column and row

    Hi

    Another way
    D3: =IF(A3<$C$3,0,OFFSET($B$3,COUNTIF(D$2:$D2,">0"),0))

    rylo

  8. #8
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: If/Then statement to move section of column to different column and row

    Ooooh! I like that one !

  9. #9
    Registered User
    Join Date
    01-16-2013
    Location
    Seattle, USA
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: If/Then statement to move section of column to different column and row

    A HUGE thank you to both Dredwolf and Rylo for helping me with this. I really appreciate your time and help!

  10. #10
    Forum Expert dredwolf's Avatar
    Join Date
    10-27-2012
    Location
    Clearwater,Canada
    MS-Off Ver
    Excel 2007
    Posts
    2,649

    Re: If/Then statement to move section of column to different column and row

    You are welcome !

    Please remember to mark the thread as solved if you are satisfied with your solution :
    To mark thread "Solved", go to the top of the thread,click "Thread Tools",click "Mark as Solved"

+ 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