+ Reply to Thread
Results 1 to 7 of 7

Thread: if then copy cell to different worksheet

  1. #1
    Registered User
    Join Date
    04-11-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    if then copy cell to different worksheet

    I have been racking my brain on this:

    If I type "Y" in cell A2 on sheet1 then I want excel copy cell B2 on sheet1 onto D4 on sheet2.

    Basicially I want to choose y and excel will copy the text beside the y to another page. But I have a few options that can be y, but only one can be at any time.

    Do you like Fruit
    Y Apple
    N Grapes
    N Oranges

    I've done it before, cannot remeber how!

    Thanks in advance

  2. #2
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010
    Posts
    474

    Re: if then copy cell to different worksheet

    Hi

    Maybe in cell D2 of sheet2 you could enter
    =IF(Sheet1!A2="","",VLookup(Sheet1!A2,Sheet1!A2:B4,2,0))
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  3. #3
    Registered User
    Join Date
    04-11-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: if then copy cell to different worksheet

    Almost, but not quite. It is only pulling the "Y" from cell A2. I might have a Y in A2, A3, or A4, and I need to pull the text in the left of those cells to the a different sheet if a "Y" is present.

  4. #4
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010
    Posts
    474

    Re: if then copy cell to different worksheet

    Hi

    Sorry, I should have realised that.
    Use Index Match instead

    =IF(Sheet1!A2="","",Index(Sheet1!B2:B4,Match("Y",Sheet1!A2:A4,0)))
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  5. #5
    Registered User
    Join Date
    04-11-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: if then copy cell to different worksheet

    Your doing better than I was.... but still not working.

    Works in A2 only.

    There is different text beside A3 amd A4, and when I put a "Y" in A3 or A4 or sheet1 it does not copy the text beside A3 or A4 onto D2 of sheet2

  6. #6
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010
    Posts
    474

    Re: if then copy cell to different worksheet

    Quote Originally Posted by best2kids View Post
    Your doing better than I was.... but still not working.

    Works in A2 only.

    There is different text beside A3 amd A4, and when I put a "Y" in A3 or A4 or sheet1 it does not copy the text beside A3 or A4 onto D2 of sheet2
    Then we need to change the IF test, (which prevents a #N/A result if there are no Y's)

    =IF(COUNTIF(Sheet1!A2:A4,"Y"),INDEX(Sheet1!B2:B4,MATCH("Y",Sheet1!A2:A4,0)),"")
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  7. #7
    Registered User
    Join Date
    04-11-2011
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: if then copy cell to different worksheet

    Works! Thanks a mil!

+ 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.2.0