+ Reply to Thread
Results 1 to 6 of 6

Copy data from one column or another based on a third

  1. #1
    Registered User
    Join Date
    06-25-2017
    Location
    Australia
    MS-Off Ver
    365
    Posts
    76

    Arrow Copy data from one column or another based on a third

    I hope I can explain this right... but maybe not, since I've spent over an hour trying to google it without success.

    I want to copy figures from two columns, based on IF a third column has the word YES in it.

    Here's an example of the raw data:

    1 2
    1 2
    1 2 YES
    1 2 YES
    1 2


    So basically I need a formula that checks to see if the word YES is in the third column. If it's blank, then copy the data in column #1. But if it says YES, then copy the data in column #2.

    So the final result would look like this:

    1 2 1
    1 2 1
    1 2 YES 2
    1 2 YES 2
    1 2 1


    Oh, and one more thing... but it may be too weird.

    Sometimes column #2 has the digit 0 in it, which is bad. It would be nice if there was some way of saying "Copy data from column #1. If column #3 says YES, copy data from column #2... unless column #2 says 0, in which case never mind and just copy from column #1."

    Like so:

    1 0 1
    1 0 YES 1


    If that's getting too weird, that's okay; I can just sort the final results manually and copy/paste the real data over the zeros. It wouldn't take long.

    But it would be wonderful if there was a formula that did the following:

    Copy data from column #2 IF column #3="YES"
    Copy data from column #1 IF column #3=blank, or column #2=0



    Sorry again for my google-unfriendly explanation.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,934

    Re: Copy data from one column or another based on a third

    Try this:

    =IF(C2="YES",B2,A2)

    By the way, did you see my improved solution here?

    https://www.excelforum.com/excel-for...hing-name.html
    Last edited by AliGW; 06-01-2022 at 05:46 AM.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    06-25-2017
    Location
    Australia
    MS-Off Ver
    365
    Posts
    76

    Re: Copy data from one column or another based on a third

    Nice!

    Sorry to badger, but was there any way to account/disregard the zeroes? I just need to know wether to leave myself some time at the end to sort the results numerically and copy/paste column #1 over them or not.

    (or maybe set up a second IF formula that says "If 0, copy from column #1", then a third formula that looks at both and copies any data >0. That should finally get the perfect result!)

    Quote Originally Posted by AliGW View Post
    By the way, ...]
    Huh.... no, I don't know how I missed that one. But I'll definitely try to play around with it once I finish setting up this new IF formula (still getting used to Office 365. I still miss 2013).
    Last edited by AliGW; 06-01-2022 at 06:23 AM. Reason: PLEASE don't quote unnecessarily!

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,934

    Re: Copy data from one column or another based on a third

    OK. This?

    =IF(AND(C2="YES",B2>0),B2,IF(A2>0,A2,"")))

    I still miss 2013
    I don't.

  5. #5
    Registered User
    Join Date
    06-25-2017
    Location
    Australia
    MS-Off Ver
    365
    Posts
    76

    Re: Copy data from one column or another based on a third

    Whoa! NICE!

    And I was just in the middle of setting up a second "If zero..." column. Happy to discard!

    Thankyou VERY much!

    (and 365 still feels to me like it's made for tablets/phones than a desktop PC... but I guess that's just a visual thing I'll get used to. I'm sure the under-the-hood stuff is MUCH preferred to enthusiasts)
    Last edited by AliGW; 06-01-2022 at 06:47 AM. Reason: PLEASE don't quote unnecessarily!

  6. #6
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,934

    Re: Copy data from one column or another based on a third

    There is so much good stuff in the subscription version that it makes older versions look pretty poor in comparison (in my opinion). New functionality is being added all the time and rolled out. No going back for me!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copy data from one column to another column based on criteria
    By paradise2sr in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-17-2022, 04:23 AM
  2. Replies: 4
    Last Post: 12-26-2019, 06:45 AM
  3. [SOLVED] VB Code to copy paste data from column to another column based on content of cell
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2019, 08:50 PM
  4. [SOLVED] Copy data from column to other sheets, based upon vlookup/criteria on column a
    By jedemeyer1 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 03-27-2013, 04:01 AM
  5. copy data based on column A
    By legolas in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 11-11-2010, 03:02 AM
  6. Replies: 2
    Last Post: 03-16-2009, 12:26 PM
  7. Copy Formula down the column based on data in the next column
    By karl_009 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2008, 09:48 AM

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