How do we split the columns in excet sheet into two columns based on the data present in the column? - excel

I have data in one column i.e., Purchases as
Purchases
2 Pens
3 Books
4 Pens
1 Gifts
2 Books
I want to split it as
Col1 Col2 Col3
2Pens 3Books 1Gift
4Pens 2Books

In Excel O365, you could use in C1:
=FILTER($A1:$A5,ISNUMBER(SEARCH("* "&INDEX(UNIQUE(MID($A1:$A5,FIND(" ",$A1:$A5)+1,LEN($A1:$A5))),COLUMN(A1)),$A1:$A5)))
Drag the formula right.

Related

How can I delete all the rows where the value of columnA is equal to the value of columnB in excel?

How can I delete all the rows where the value of columnA is equal to the value of columnB in excel? I found some articles but they are all talking about deleting rows with some conditions for one row (then i can use filter in excel to get the rows). But how can I filter rows where the condition needs values from two columns? thanks.
like if i have
Row columnA columnB
1 10 10
2 20 20
3 30 40
4 50 70
then I want to keep row 3 and row4 and delete row 1 and row2 because they have the same value for columnA and columnB
OPTION 1
Something like this in an adjacent column?
=FILTER(A:B,A:A<>B:B,"")
It will reproduce column A without the duplicates.
OPTION 2
If you are looking for a way to quickly distinguish where the rows match and do not match (based on your comment) I would suggest a conditional format using the following:
=$A1<>$B1
OPTION 3
Or utilize the formula in cell C1:
=IF(A:A<>B:B,"Not Equal","")

How to Compare 2 excel sheet row wise where order of data is not fixed

Comparing 2 excel sheets where we need to find id and match next column and if difference then highlight the difference cell.
eg;
Sheet 1
123412 Bob Y
112234 Jill Y
998822 Carry Blank
Sheet 2
112234 Jill XX
998822 Carry Blank
123412 Jack ZZ
Here sheet 2, 123412 has different data in col2 and col4
Also, Sheet 2, 112234 has different data in Col3 when compared with sheet1
I need to highlight the cells so that difference can be identified easily.
There is huge amount of data.
Highlight, Sheet2- Jack, ZZ and XX cells and
Sheet1 - Bob, Y, Y(of Jill)

Finding and obtaining the difference between two columns

I have two columns. Each column has tens of thousands of values. I need to find the difference between them and print the difference in some cells. I read similar questions, but they are not enough for my question, highlighting the different cells is not enogh for me because it would be very tiring to look at tens of thousands of cell by searching highlighted cells. Thus, i need to obtain the values.
Example:
Column1 Column2
John Jennifer
Mary Washington
Joe John
Michael Texas
Houston Newyork
Texas Mary
Values existing in col1 but not col2 : Joe, Michael, Houston
Values existing in col1 but not col2 : Jennifer, Washington, New York
Algorithmically, i need to check each row of column1 whether it exists in Column2, if the row does not exist in Column2, the value is taken.
Similarly, i need to check each row of column2 whether it exists in Column1, if the row does not exist in Column1, the value is taken.
Thanks
Old: If this is a once-off i'd make a backup then mark the area of the two columns and "remove duplicates" which is a button on the DATA command bar.
You would be left with unique records only, which is what I understand you want.
Edit: If you want to completely remove duplicate values then: Assuming that col1 is "A" and col2 is "B" then this formula only shows the record if it is in A but not in B. You can make a similar one for B not in A. In my example I made two columns C, D for the unique values. Then filter the list on these being "not nothing", and you have a set of unique records.
Current formula is for A2 cell - in my example placed in C2.
=IF(ISERROR(MATCH(A2;B:B;0));A2;"")

How to get sub ranges from pivot table

I have a table like this
col1 col2
a 1
a 2
a 3
a 4
a 5
b 6
b 7
b 8
b 9
b 10
I want to write a PERCENTILE function for each group in col1. Is there a way by pivoting this table and writing custom function PERCENTILE. But calculated field in pivot table is not allowing to write functions. I have to do this without VBA
I have to write, to find average of top 70%, something like below. But how to get sub ranges?
col1 col2
a =AVERAGEIF(B1:B5,">"&Percentile(B1:B5,0.7))
b =AVERAGEIF(B6:B10,">"&Percentile(B6:B10,0.7))
You could do that with an array formula since the percentile function accepts arrays:
=PERCENTILE(IF($A$2:$A$11=D2,$B$2:$B$11,""),0.7)
This needs to be entered as an array formula with ctrl+shift+enter.
{=PERCENTILE(IF($A$2:$A$11=D2,$B$2:$B$11,""),0.7)}
Just auto-fill that down the column. Let me know if you need an example of how to copy-paste the unique values of a column.
You can test it like so if you want. It works:
=PERCENTILE(B7:B11,0.7)
Good Luck.

Excel merge columns

Hi all I want to merge to columns in excel 2003.
For example:
Col1 Col2
------------
1 5
3 4
4 6
7 6
The merged column should look like this:
Col3
----
1
3
4
4
5
6
6
7
Thanks!!
Assuming, that your Col1, Col2 and Col3 are Columns A, B and C, you can use makro:
Range("A1:" & Range("A65536").End(xlUp).Address).Select
Selection.Copy
Range("C1").Select
ActiveSheet.Paste
Range("B1:" & Range("B65536").End(xlUp).Address).Offset(1, 0).Select
Selection.Copy
Range("C65536").End(xlUp).Select
ActiveSheet.Paste
Source: link
Although you could easily use Excel's built-in functions to copy and paste the values from each column into the third column, you don't state if it's a requirement that the results in Col3 need to be sorted, or whether duplicate values should be removed or not. If so, you might have to write a user-defined function (equivalent to an Excel macro) in Excel VBA to do this.
Your solution might look like this (pseudo-code):
Iterate through all rows in Col1 and store values in an array
Iterate through all rows in Col2 and store values in a second array
Create a new array and combine the values from the other two arrays
Output the values from the combined array into Col3
Your function/macro will probably need to accept three input parameters which would be the ranges of the two source columns and the output column.

Resources