I would like to split the rows out in the first table based on comma separated values in Column C.
So columns A,B,D,E would be duplicated for each comma separated value in column C.
So the data would result in the table below.
Thanks
Here's an algorithmic approach you can try
Get a reference to your data range
Loop over the rows in that range
Since you're going to be adding rows, loop bottom to top
For each row
Split the value in column C
If the resulting array has > 1 values, insert rows for the new values
Copy Values into the new rows
Transpose the Split array into column C
Repeat
Related
I want to merge excel rows comparing values of two columns: Column A and Column B.
If the values of Col A and Col B are same it should be merged with other rows(can be multiple rows) which has the same values in Col A and Col B.
Values in Third column should be appended with comma to the merged row.
Please refer this image to get more clarity, it is easier to explain with an example:
As per my below screenshot try-
E2=UNIQUE(A2:B4)
G2=TEXTJOIN(", ",TRUE,IF($A$2:$A$4&$B$2:$B$4=E2&F2,$C$2:$C$4,""))
I have data of multiple columns and multiple rows, like 2-D array. But all column doesn't have same number of rows. let say column1 has only data in 5 row while column2 has data in 10 rows. I need to create a drop down based on column. If Column1 has values in 5 rows then drop down will display 5 values. similarly for column2. I have used Index() function in formula to display whole column as drop down.
=INDEX($A$2:$I$11,,2)
here 2 is for 2nd column
Now My problem is, I need to replace the hard coded row number into function. here last row number is 11, I want to replace it to ROWS() funtion. Then how to write Index() function.
Simply My question is how to replace the cell reference in a function to other function ?
You can use the OFFSET function with the COUNTA function for the height argument to get the right number of rows. Once you have created the first drop-down list, you can simply drag that cell to create the drop-down lists for all the other columns.
For example, you could enter the following formula for the drop-down list in cell A2 of your sample table:
=OFFSET(A3,,,COUNTA(A3:A99))
Note that in this example, the row range is hardcoded to avoid counting the rows with the column header and the drop-down cell itself by starting the row count at row 3 up to a randomly high row number (row 99) that will never be exceeded. In other situations, you may be able to simply include the entire column with A:A without ending up with blank options in the drop-down list.
I want to define a dynamic range that will expand the rows and columns of my range whenever a new row or column is inserted. My current formula does not want to expand to cell $T$13. My headers start in row $M$7. How can I adjust my formula?
Formula Being Used
=OFFSET(Sheet1!$M$8,0,0,COUNTA(Sheet1!$M:$M),COUNTA(Sheet1!$1:$1))
I need my range to expand to cell $T$13
Right now, your formula counts the number of text values in column M.
That is not a robust approach because column M contains only five text values, but columns S and T have many more values.
If you don't know which column may have the most number of entries, you can introduce a helper cell in each column that counts the number of entries below. I suggest you insert a new row 2. In column M, for example, put a formula in M2
=counta($M$3:M$99999)
Copy that formula across to column T.
Next you can evaluate which of the columns has the largest number
=max(M2:T2)
This can be plugged into your original formula like this:
=OFFSET(Sheet1!$M$8,0,0,max(M2:T2),COUNTA(Sheet1!$1:$1))
So now, instead of just looking at how many rows are in column M, the formula uses the maximum number of rows in the columns M to S.
You can now hide row 2 if it upsets your worksheet design.
Edit: the mere count of text values with CountA will ignore blank cells and will return incorrect results. You really need a formula to find the row number of the last populated cell in each column.
This should really be a new question, but here goes
If the column has number values you can use
=MATCH(99^99,B5:B999,1)
If the column has text values you can use
=MATCH("zzz",C5:C999,1)
Adjust your ranges accordingly.
I ended up using the solution mentioned by #tevlyn.
In range$M2:$T2
I have the follolwing formula =IFERROR(MATCH(99^99,M$8:M$999,1),0).
I've added IFERROR because my data doesn't always have data stretched to $T2.
I then defined my range in name manager using:
=OFFSET(Sheet3!$M$8,0,0,MAX(Sheet3!$M$2:$T$2),COUNTA(Sheet3!$1:$1))
This still works even if there are blanks in between the range.
I have multiple comma separated rows in excel with drugs name
e.g.
1) drug1,drug2,drug3,drug4
2) drug1,drug2,drug3,drug5
3) drug1,drug2,drug5,drug6
What I want to do is make these rows column such that all these rows distinct values becomes column. So in our case drug1,drug2,drug3,drug4,drug5,drug6 will become column and in rows they should have 0 if that row doesn't have that drug and 1 if it has that drug in that row.
Any help will be appreciated.
Here's a screenshot of how I would do it in multiple steps.
split the data text to columns (data menu, text to columns)
copy data into a single column (B) (copy range B2:E4) into B10, then copy out of C10-End of range and put back into B13 etc) (and have 2 columns one for rowID and one for value
For rows 10,11,12 manually 1-3. copy and paste using ctrl-down arrow to fill in each series until all filled in .
generate pivot Table (layout included now.)
This is assumign this is a one time thing and throw away. If this has to be done repeatedly I'd macro it.
I have two columns in excel that have some shared data and some unique data to each column. What I want is to have two more columns that will have the data that is in Column A but not B and the data that is in Column B but not in A. I have tried using Vlookups but I don't think I can get what I am looking for by doing this.
For Col A items not in column B, try this array-entered formula (entered in some cell, then fill down until it returns blanks)
=IFERROR(INDEX(ColA,SMALL(IF(ISNA(MATCH(ColA,ColB,0)),ROW(ColA),""),ROWS($1:1))-1),"")
and for Col B items not in Column A:
=IFERROR(INDEX(ColB,SMALL(IF(ISNA(MATCH(ColB,ColA,0)),ROW(ColB),""),ROWS($1:1))-1),"")
The formulas assume that your data starts in row 2 (row 1 would be a label) and the ranges ColA and ColB also start in Row 2
The formulas also assume no blanks in the data. If there are empty cells, then use these formulas:
=IFERROR(INDEX(ColA,SMALL(IF(ISNA(MATCH(ColA,ColB,0))*(ColA<>""),ROW(ColA)),ROWS($1:1))-1),"")
=IFERROR(INDEX(ColB,SMALL(IF(ISNA(MATCH(ColB,ColA,0))*(ColB<>""),ROW(ColB)),ROWS($1:1))-1),"")
Example Image:
Easy with a PivotTable, if you are prepared to rearrange your data somewhat: