excel/google sheet - combining 2 column into 1 (vertically) - excel

what is the formula to combine 2 column into 1?
(sheet link included : here)
for example :
Column A
Column B
Cell 1
Cell 2
Cell 3
Cell 4
Cell 5
Cell 6
become :
Combined
(with the spacing blanks included)
Cell 1
Cell 3
Cell 4
Cell 6
Cell 2
Cell 5
this is the database primary sheet, so the plan is i will load/link from this database sheet to another sheet (plus in case i have another cell to add between, it will sorted out automatically)
i try arrayformula({A:A;B:B}) but it tells me to add another row ?
help please
formula tried :
arrayformula,
flatten,
(it tells me to add another row?)
unique
(it overwrite the doubles? and remove blank space?, i need the text to be it as it is)

Try the following formula for raw materials. Then use same formula for packaging and change column references.
={FILTER(A:A,A:A<>"");" ";FILTER(E:E,E:E<>"")}
Edit: To include blank cells try this formula-
={C1:INDEX(C1:C,MATCH("zzz",C1:C));" "; G1:INDEX(G1:G,MATCH("zzz",G1:G))}

Related

Extract only rows that are not in both sheets into a third sheet

I have 2 excel sheets with similar column values (legal_id). Is there a way to extract only rows that are not in both sheets into a third sheet? For example if social security number 111111 isn't in both sheets, then that persons row would be placed in the third sheet..please see images below.
Sheet 1
Sheet 2
Sheet3_DesiredResults
Before I get backlash about not attempting code this is what I tried,
I thought this formula would highlight true or false to values that are not in the same sheet, then I could just delete every field that returned true to be in both sheets , but it doesn't work. I'm not a programmer, I need help. Please don't tell me to take a VBA tutorial.Instead of making a third sheet , I made a helper column on the first sheet and used the formula:
=(ISNA(MATCH(A2,Sheet1!A:A,0)))=FALSE
Like anticipated in my comment, you might use 2 ranges in the third sheet and the COUNT.IF function. The formulas you need are these:
=IF(COUNTIF(Sheet2!$A:$A,Sheet1!$A2)=0,Sheet1!A2,0)
.
=IF(COUNTIF(Sheet1!$A:$A,Sheet2!$A2)=0,Sheet2!A2,0)
Place them in 2 proper cell in the third sheet (let's say A2 and E2), drag them to cover the two lists. Empty cells or cells with IDs in both Sheet1 and Sheet2 will return 0. If you don't like 0 and you prefear "", you might use these:
=IF(IF(COUNTIF(Sheet2!$A:$A,Sheet1!$A2)=0,Sheet1!A2,0)=0,"",IF(COUNTIF(Sheet2!$A:$A,Sheet1!$A2)=0,Sheet1!A2,0))
.
=IF(IF(COUNTIF(Sheet1!$A:$A,Sheet2!$A2)=0,Sheet2!A2,0)=0,"",IF(COUNTIF(Sheet1!$A:$A,Sheet2!$A2)=0,Sheet2!A2,0))
I have solved your query. Please have a look below.
First as expected, i created 2 sheets with same data as mentioned in image for simplicity.
Sheet 1 with Helper column
Sheet 2 with Helper column
Step 2 : I converted the sheet data into table for efficiency.
Step 3 : I used the COUNTIF function and IF function in Sheet 1 Helper column throughout.
=IF( COUNTIFS(Sheet2!Legal_id, [#[Legal_id]]) = 0, "N/A","" )
Similiarly we have to implement this formula in Sheet 2 Helper column.
=IF( COUNTIFS( Book1!Legal_id, [#[Legal_id]]) = 0, "N/A", "")
Explanation of above formula: The COUNTIF Function counts number of corresponding occurrences of Legal_id, in Sheet 2 Legal_id column. If count = 0 i.e means legal_id is not present in Sheet 2, so we use IF statement to assign 'N/A' value in Helper column else nothing ''.
Same explanation follows for sheet 2.
Now We Filter the Rows with N/A values to delete as mentioned by you in comments. or Insert it in third Sheet by copy paste.
The best way to accomplish your task is to use vba. But, if you want to use the ISNA(MATCH formula, you will need to wrap your formula in an IF statement and place the formula in each cell in Sheet3.
STEP 1: Paste the below formula in Cell A2
=IF(ISNA(MATCH(Sheet1!A2,Sheet2!A:A,0)),Sheet1!A2,"")
STEP 2: hold down CTRL+SHIFT+ENTER to enter it as an array formula
STEP 3: Hover over the dot in the right-bottom corner of the cell and drag down to the number of used rows you have in Sheet1 Note: the formula will change for each row
STEP 4: Then drag across to Column C Note: the formula will change for each column
The data from Sheet1 that is not in Sheet2 will now be in Sheet3, separated by blank rows, you can select the blank rows and delete them.

Group 2 columns and sum values for another column

I have the following problem: I need to group data and perform a sum in another column in libreoffice calc/excel spreadsheet, just like a group by would do in SQL
In the following example, I would like the cells A26, A27 to become one line, and cell C26 should be the sum of the 2 rows.
Try on E26 cell the formula =($A26 & $B27) (Or =($A26 & (-$B27)) if you want a dash between A26 and B27).
And on F26 cell =($C26+$C27) for the sum of rows.
Copy/Paste for the other cells of each col

Combining data in excel

Dears,
I have 4 columns in excel.
Each row have two values but also it is mapped to another row.
I'd like to sum the values from these the rows that are mapped and delete the extra rows.
Example attached: Row A has two values but also mapped to Row C. I want to add the values in Row A with the ones in Row C and keep Row A and delete Row C
Is it possible to use formulas instead of VBA as I don't have experience in VBA?
Please advise.
Assuming your Keyword data starts with A2 and Value 1 starts with B2 and Value 2 starts with C2. (Please refer the snap below)
Apply the below formula in H2 for Value 1 summing and drag down
=IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,2,FALSE),VLOOKUP(G2,$A$2:$D$4,2,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,2,FALSE))
Apply the below formula in I2 for Value 2 summing and drag down
=IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,3,FALSE),VLOOKUP(G2,$A$2:$D$4,3,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,3,FALSE))
EDIT #1 If G value does not contain in Table 1 then apply the below formula
in H2
=IF(ISERROR(IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,2,FALSE),VLOOKUP(G2,$A$2:$D$4,2,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,2,FALSE))),"Not Found in Table",IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,2,FALSE),VLOOKUP(G2,$A$2:$D$4,2,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,2,FALSE)))
in I2
=IF(ISERROR(IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,3,FALSE),VLOOKUP(G2,$A$2:$D$4,3,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,3,FALSE))),"Not Found in Table",IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,3,FALSE),VLOOKUP(G2,$A$2:$D$4,3,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,3,FALSE)))

Search columns and return number of cells containing "5" against colleague name

What I'm looking for is a formula that will do the following: (I'll be using the first row for this example):
Firstly check cells E:J for cells containing a 5.
If all cells contain a 5 it will check the person's name and then add this to the box in column B against the correct name.
If cells E:J have less than 5 in any of these cells it will disregard this row altogether.
To clarify, for Shaun it will count how many rows next to his name have 5's across the board then put the total number of rows fitting this criterion next to his name in Column B.
We can do this with a helper column:
Helper column, keep the name if the count of 5 equals to 5.
Enter below to K2 and fill down.
=IF(COUNTIF(E2:J2,5)=5,D2,"-")
Then we are counting how many times name appears in the helper column. Enter below to B2 and fill down.
=COUNTIF($K$2:$K$11,A2)
Create formula in K2 (output the name if all values are 5)
=IF( AND(E2=5,G2=5,H2=5,I2=5,J2=5), D2, "")
Create the formula at B2which will sum all occurrences of the names
=SUM(IF(K2:K11=A2,1,0))
(and press ctrl+shift+enter)
You maybe will need to replace , with ; (depends on your excel version).

Excel - Summary count of multi-column duplicates

I can't seem to wrap my head around an answer for this. I can find duplicates when using a formula that looks at a single sell and compare it to a range of cells, and copy that formula down every row; afterward I can just sum the results. However, I want a single formula in a single cell.
I want to take a range of cells in one column, compare that entire set to a range of cells in another column, and sum all duplicate cells where the cell in column 1 matches a cell in column 2. For this exercise, all cells in each column are unique within that column, they are only potentially duplicate between columns.
For example:
C1 C2
R1 1 2
R2 2 6
R3 3 7
R4 4 1
R5 5 8
I want a single column sum with a result of 2 (the duplicate cells in C1 is 1 and 2).
This will ultimately be converted into a VBA script however I can work with starting with a single formula. If starting out at VBA is easier then that works for me too.
My specific question is: which functions in excel do I use to accomplish this task?
Thanks for your help.
I believe the formula you want in cell C3 is:
=IF(ISERROR(VLOOKUP(A1,$B$1:$B$5,1,FALSE)),0,1)
This will return a 1 if your column-1 value appears in column 2, and a 0 if it doesn't. Then you can simply copy it down for the extent of your data (changing the referenced range as needed) sum the results of column 3. (Note that the FALSE is important as it forces exact matches; otherwise, Excel will display approximate matches, which will compromise the accuracy of your results.)

Resources