Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1049221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:34:53+00:00 2026-05-16T16:34:53+00:00

What I have: two columns of text data, that are given to contain only

  • 0

What I have: two columns of text data, that are given to contain only distinct (no duplicate) items.

What I want: The second column sorted such that corresponding items are aligned in the same rows. If the first column contains an item with no match in the second column, that row is left blank in the second column. If the second column contains items with no match in the first, all such items are appended below the last row of the first column. While not required, feel free to assume the first column is sorted alphabetically.

Example   
Before         After 
Col1    Col2    Col1 Col2
A       Q       A       A
B       E       B       B
C       B       C       
D       W       D       
E       A       E       E
                        Q
                        W

This small example is quite easy to do by eyeball, but my data may contain from a few hundred to about two thousand items.

Thanks in advance.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:34:54+00:00Added an answer on May 16, 2026 at 4:34 pm

    There’s no practical way to do this in 1 step with a formula exactly as you want.
    You CAN do it, but it would be so much obfuscated INDEX/ROW stuff that it’s not readable.
    Are you able to separate it into multiple steps, or do transformations after excel? Depending on what your context is, different
    solutions will be more practical than others.

    Assuming your sheet is like:

     A       B
    ---     ---
     A       Q
     B       E
     C       B
     D       W
     E       A
    

    I can do it in 3 added columns:

    1. Find matching values, and rows to skip, with the formula (put in C2) ="0"&IFERROR(VLOOKUP(A2,$B:$B,1,FALSE),"").
    2. Find non-matches with the formula (put in D2) =IF(ISNA(VLOOKUP(B2,$A:$A,1,FALSE)),"1"&B2,"")
    3. Merge them together, column C before column D, with formula in E2: =IF(ROW(E2)<=COUNTA(C:C),C2,INDEX(D:D,ROW(E2)-COUNTA(C:C)+1)). Note that the +1 is because I assume there’s a column header.

    This results in:

     A       B       C        D       E
    ---     ---     ---      ---     ---
     A       Q       0A       1Q      0A
     B       E       0B               0B
     C       B       0                0
     D       W       0        1W      0
     E       A       0E               0E
                                      1Q
    
    
                                      1W
    

    Now you can copy/paste as text column E somewhere, sort it, and remove the 1st char. Adding the 0 and 1 allows column E to be sorted in this way. If you don’t
    do it this way, you won’t be able to discriminate between “removing blanks” and the desirable blank rows.

    That’s a lot of steps to do this; you may consider writing a macro to do it if you need to automate this more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datagrid that displays items with two columns of text row data
I have a postgres function that returns two columns result, data (int), (text) If
I have a table which has columns of data that contain status. Two example
I have two text files with various columns, each column is separated by a
I have SP that selects data from a table with two columns like this
I'm using NHibernate 2.1.2 and Spring 1.3 I have two Text columns (blobs) in
I have two columns in my NSOutlineView. One is a Text and image cell
I have two columns. Column E extends up to 99504 (values) and column I
I have two columns in a data frame, and I have been able to
I have two columns. ColA and ColB contains char(10) with data 20090520 and 20090521.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.