Sorting one column based on another one in excel - excel

How do I get column E to skip rows where there no duplicate in column A.

Instead of trying to figure out how to insert blank rows in Column E and F where there is a missing value based on A... use a Vlookup() in Column D to grab the relevant pieces from Column F:
Assuming your data starts on A16 according to your picture, in D16 enter:
=Vlookup(A16, E:F, 2, False)
And copy that down. Now you will have Column F values in their appropriate rows in Column D.

Related

How to move data from one column to another without overwriting existing values in destination column

I'm hoping this is so simple I'm just over-looking the obvious answer! I want to move the values (pictured) in column A, en-masse, to the blank cells in column B without overwriting the existing values in column B. Note that the data in column B has differing number of rows. Any ideas?
enter image description here
There are a couple of options to do this:
Option 1
Place a filter onto the data
Filter column B for blank values
Enter a formula into B1 that is =A1
Drag this down to the bottom of your cells
Set the filter for all values
Select the whole of column B
Copy and Paste the data as values
Option 2
Create a new column after B
In this column enter the following formula - =IF(B1="",A1,B1)
Drag this down to the bottom of your data
Select the whole of column B
Copy and Paste the data as values
Delete column B
Column C then becomes column B
I knew I was missing something...Copy Column A, highlight column B, 'Paste special', tick 'Skip blanks' checkbox and done! Many thanks for reading.

How to find non matching records from two columns while accounting for duplicate values in Excel

I have two large columns.
Column A contains 100,000 different numbers/rows. Column B contains 100,210 numbers/rows. They have the same numbers except column B has 210 extra rows. I need to be able get the values of that extra 210 rows.
The issue im having is that the numbers in these rows are not unique.
For example,
Column A contains the following numbers: 2,1,3,4,5,5,6,7
Column B contains the following numbers: 1,2,3,4,5,5,5,5,6,6,7,8
I want the outcome result to be: 5,5,6,8
I can't seem to wrap my head around a way to do this.
I have the two columns in a text file that im importing into excel. If there are better ways to do it outside of excel, I am open to it too.
With the Dynamic Array formula Filter:
=FILTER(B1:B12,COUNTIF(OFFSET(B1,0,,SEQUENCE(ROWS(B1:B12))),B1:B12)>COUNTIF(A:A,B1:B12))
Without FILTER:
Put this in the first cell and copy down:
=IFERROR(INDEX(B:B,AGGREGATE(15,7,ROW(B1:B12)/(COUNTIF(OFFSET(B1,0,,ROW(INDEX($ZZ:$ZZ,1):INDEX($ZZ:$ZZ,ROWS(B1:B12)))),B1:B12)>COUNTIF(A:A,B1:B12)),ROW($ZZ1))),"")
Try to follow these steps, supposing that Column A has less values than the Column B and the rows start at 1:
A. Create Column C.
In the cell C1 place the function: =COUNTIF(A:A;B1)
Copy this function to the rest of cells, for all items of Column B. So, cell C2 will have the function =COUNTIF(A:A;B2) and so on.
B. Create column D.
In the cell D1 place the function: =COUNTIF($B1:$B1;B1)
Copy this function to the rest of cells, for all items of Column B. So, cell D2 will have the function =COUNTIF($B$1:$B2;B2) and so on.
C. Create column E.
In the cell E1 place the function: =IF(D1<=C1,"Exists","Missing")
Copy this function to the rest of cells, for all items of Column B. So, cell E2 will have the function =IF(D2<=C2,"Exists","Missing") and so on.
D. Filter to show only the rows that Column E values are "Missing".
Of course you can combine all above 3 columns to one (e.g. in Column F), so these cells will have the functions:
F1: =IF(COUNTIF($B$1:$B1,B1)<=COUNTIF(A:A,B1),"Exists","Missing")
F2: =IF(COUNTIF($B$1:$B2,B2)<=COUNTIF(A:A,B2),"Exists","Missing")
and so on
Explanation:
In column C we count how many times the value of the respective cell
of Column B exist in the whole Column A.
In Column D we count how many times we have "met" this value in Column B so far.
In Column E we check if we have "met" the value more times that it exists in Column A. If indeed we have "met" it more times, then we mark the cell as "missing"
Tested with the example you provided and works okay.
I hope it helps!
Good luck!
EDIT - Addition of Screenshot

Check if a cell value is found in a column where cells may have multiple values then return a third cell value

I am trying to check whether the value in each cell within Column A is in Column D. Some cells in Column D have multiple values within a single cell. If the value of Column A IS found in Column D then I want the formula to return what's in Column B (value next to Column A that matched).
Try:
Formula in C2:
=IF(SUMPRODUCT(--(ISNUMBER(SEARCH(A2,$D$2:$D$5))))>0,B2,"")
Drag down..
If you are looking at just row by row analysis then try this:
=if(iserror(search(a2,d2)),"",b2)
if you are trying to match any row in D then I suggest breaking out all items in D into an item per row and then doing a VLOOKUP
Can you copy column B to Column E? If so,
=Vlookup("" & A1 & "", D:E, 2,0) and scroll down.
If not, a similar index(match( function will work with a wild card. (*)

Is there a formula to line up column rows based on cell value or partial value?

I have a sheet with 4 columns, see screenshot_1
Column A - word
Column C - word (column A) + extra word
The rows of Column A and column C and their values (column B and D) are not lined up. As you can see in the screenshot,
I want to place C2 And D2 on line 29, C3 and D3 on line 15, etc. So column C and D are filled with the matching word of column A (if it exists).
Resulting in something like screenshot_2
Is there a formula to line up column rows based on cell value or partial value?
Screenshot 1
Screenshot 2
You can achieve this by using wildcard in Vlookup. Enter this formula =VLOOKUP("*"&A2&"*",$F$2:$G$26,2,FALSE) in column C.
Possibly the easiest solution would be to keep columns A and B untouched, and have column C automatically display "used (whatever)" if column D contains a number.
To accomplish this, type the following formula into cell C2 and drag down:
= IF(ISNUMBER(D2),"used "&A2,"")
First, separate the ranges with some empty columns; so column A & is the same, C is empty, D & E are a not connected
Create a new column in the empty C column:
=IFERROR(IF(MATCH("*"&A2&"*",F:F,0),VLOOKUP("*"&A2&"*",F:G,2,0),""),"")
See this Example

Excel copy cell A to cell C if cell B duplicate

I have two columns in excel with column A is a numbers and column B is a duplicate of various texts.
I need a way to copy the column A to column C if column B is duplicate?
If you are simply trying to indicate duplicates, would this work for your case (formula goes in C2)?
=IF(COUNTIF(B:B,B2)>1,A2,"")
Work on a copy, with data headers assumed to be in row 1.
Sort data by column B.
In C2, type =IF(B2=B1,A1,"")
and copy down the sheet.
Then, if there's a duplicate, it will appear in column C

Resources