+ Reply to Thread
Results 1 to 15 of 15

Excel formula to fill column B with unique values from column A

  1. #1
    Registered User
    Join Date
    07-15-2021
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    10

    Excel formula to fill column B with unique values from column A

    Hi,

    I need a formula in which cells in Col B are automatically filled when Cells in Col A are filled, such that there are no repeat values in Col B. Please refer to the attached excel file.

    Thanks

    Sam
    Attached Files Attached Files

  2. #2
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Excel formula to fill column B with unique values from column A

    You know there is a built in function in excel that can do that w/o a formula.
    just copy column A, paste it into col B, use remove duplicates under the data tab at the top, when it asks you if you want to expand the selection click continue with the current selection, then hit remove duplicates.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  3. #3
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.84 for Mac MS 365
    Posts
    8,499

    Re: Excel formula to fill column B with unique values from column A

    This formula will work for you but you need to have the data begin on row 2, not row 1. You'd paste it into cell B2 and drag down until you get blanks...
    =IFERROR(INDEX($A$2:$A$1000,MATCH(0,INDEX(COUNTIF($B$1:B1,$A$2:$A$1000&""),),0))&"","")

  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,903

    Re: Excel formula to fill column B with unique values from column A

    If you had MS365, this would suffice:

    =UNIQUE(A:A)
    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.

  5. #5
    Registered User
    Join Date
    07-15-2021
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    10

    Re: Excel formula to fill column B with unique values from column A

    Thanks Ali. Unfortunately, I am on Excel 2016.

  6. #6
    Forum Expert wk9128's Avatar
    Join Date
    08-15-2020
    Location
    Australia
    MS-Off Ver
    365 V2403 and WPS V2022
    Posts
    3,425

    Re: Excel formula to fill column B with unique values from column A

    Cell B1 non array formula , Drag Down

    HTML Code: 
    array formula , Drag Down
    HTML Code: 
    Last edited by wk9128; 07-15-2021 at 10:02 AM.

  7. #7
    Registered User
    Join Date
    07-15-2021
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    10

    Re: Excel formula to fill column B with unique values from column A

    Thanks Sam.

    Your formula works. But, let's say if there's a value "led" in Col A, then this "led" should not appear in Col B.

    Is it possible to fill Col B by extracting unique values from Col A based on multiple conditions?

    For instance...

    first condition, "led" in Col A to be ignored
    second condition, no X in Col C
    third condition, Y in Col D

    Pl refer to the updated question excel.

    Ali, Would Unique formula supoort multiple conditions as mentioned above?

    Thanks

    Sam
    Attached Files Attached Files
    Last edited by CV_Sam; 07-15-2021 at 10:06 AM.

  8. #8
    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,903

    Re: Excel formula to fill column B with unique values from column A

    Sam - this is a MASSIVE shift of the goalposts!!!

    Before anyone answers you, have you got any more requirements? If so, state them all NOW - do not drip feed them into the thread, as that is not fair on your helpers.

    Ali, Would Unique formula supoort multiple conditions as mentioned above?
    You don't have MS365, so you can't use it, but if you did, you'd combine it with FILTER.
    Last edited by AliGW; 07-15-2021 at 10:07 AM.

  9. #9
    Registered User
    Join Date
    07-15-2021
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    10

    Re: Excel formula to fill column B with unique values from column A

    Just this. I am extremely Sorry for not stating it in the first post itself. The multiple conditions will solve my problem.

    Thanks

    Sam

  10. #10
    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,903

    Re: Excel formula to fill column B with unique values from column A

    Thanks - you only need to state the new requirements once. I have removed your duplicate post.

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,054

    Re: Excel formula to fill column B with unique values from column A

    Maybe this:

    =IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$2:$A$15)/(($A$2:$A$15<>"led")*($C$2:$C$15<>"x")*($D$2:$D$15="Y")),ROWS(F$2:F2))),"")

    in F2, copied down:
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  12. #12
    Registered User
    Join Date
    07-15-2021
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    10

    Re: Excel formula to fill column B with unique values from column A

    Thanks Glenn. Your formula works perfect for the three conditions. But when I use it for just first condition or first and second condition (by deleting them from the formula) then I am getting the wrong values which I have highlighted in yellow in the attached updated excel file.

    How to adapt the formula such that I can use it for one, two or three conditions depending on the need?

    Thanks

    Sam
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: Excel formula to fill column B with unique values from column A

    For column H try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    For column L try:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Note that both of the above are array formulas which are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
    Note that the first formula will return a "d", however the second instance of "d" doesn't correspond to an "x" in column C.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  14. #14
    Registered User
    Join Date
    07-15-2021
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    10

    Re: Excel formula to fill column B with unique values from column A

    Thanks JeteMc.

    Thanks a lot for the formula. It works fine on all the three conditions and I can adapt it for one or two conditions too.


    Sorry for the late reply. Due to certain family medical reasons I wasnt able to come online and do anything.

    Thanks and regards,

    CV

  15. #15
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,567

    Re: Excel formula to fill column B with unique values from column A

    You're Welcome and thank you for the feedback. I hope that the family medical issues had a good outcome.
    Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post.
    I hope that you have a blessed day.

+ 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. [SOLVED] Formula to Fill Down Values in Column D
    By bjnockle in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-16-2020, 09:14 AM
  2. Replies: 7
    Last Post: 10-23-2018, 10:18 AM
  3. Replies: 12
    Last Post: 01-16-2016, 10:13 AM
  4. Replies: 2
    Last Post: 08-19-2015, 10:22 AM
  5. Apply a formula in a new column that pulls unique values from another column
    By shepherdc2814 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-24-2014, 10:04 PM
  6. Fill Column B based on non-unique values in Column A
    By viksmehta in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-21-2014, 07:39 AM
  7. Count Unique Values In One Column Basis Unique Values in Another Column
    By shez_raz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-07-2012, 01:55 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