Google Sheet Concatenate certain cells contents of selected rows - concatenation

I have a table with two columns. Column A includes dates and column B contains simple text. The date column has duplicates. What I want to have is concatenate the contents of column B cells for identical dates. Basically, similar to running a query and grouping on the date column with an aggregate function like sum() on column B; but there is no aggregate function for text. The solution needs to be for a dynamic list, as the input is made via a google form by the users.
This link offers a solution but you have to copy and paste the rows.
Many thanks
Sabba

Related

How can I merge duplicate rows in a Spreadsheet while summig the numerical columns?

My Project Reports come from two different sources as we have changed the Project Management tool middle of the year. Therefore, I have prepared two tabs within a Google Spreadsheet with the data from the two systems under same set of headings. Then I combined the two sheets into one using the following query,
=QUERY({'Sheet1'!A1:I1000;'Sheet2'!A2:I1000},"select * where Col1 <>''")
Some of my projects are present within the both the list as they were started early in the year. In order to avoid duplicates I need to merge the two rows representing the same project into one. The project names are identical. However, I need to get the sum of some of the columns such as the 'Time Spent' in order to receive the total value for the whole period. At the same time, columns such as ' Project Owner' are identical among the two rows.
How can I combine these duplicate rows into single rows while merging the selcted columns?
Thank you in advance for your support!
syntax is:
=QUERY({Sheet1!A1:B; Sheet2!A2:B},
"select Col1,sum(Col2)
where Col1 is not null
group by Col1
label sum(Col2)''")
where A column is text and B column are numeric values

How can I add a prefix to the column names of a join table in T-SQL?

I am joining two tables in T-SQL which have the same column names and I want to distinguish them not only via a reference but also I want to distinguish them in the resulting joined table.
I want to add a prefix for all the columns coming from the original or the joining table, e.g. Table1-Col1, Table2-Col1, etc.
Is there a quick way to do that so that I won't have to repeat all the columns one by one in the query?
RE: "Is there a quick way to do that so that I won't have to repeat all the columns one by one in the query?"
Not sure how quick you will find the following. I do this all the time with wide tables. Break even vs doing them one at a time is about 6 or 8 columns for me. Your mileage may vary.
Drag and drop the "Columns" tab under the table in ObjectExplorer into an SSMS query window. This gives a comma separated list.
Copy the comma separated list into Excel.
Use Data - Text to columns. Converts comma delimited string to a set of columns in spreadsheet.
Copy columns to clipboard.
Paste Special with Transpose selected
Use CONCAT in a cell in the next column over to build a formula that creates column strings. For example,
=CONCAT(", ", A17, " as Table1-", A17)
Copy the formula to all columns
Copy the columns back to SSMS. You will have an extra comma that needs to be eleted at this point.
As noted, I use Excel for these types of conversions regularly.

Alternative to VLookUp that can check if two factors are true

I am wondering is there any alternative to VLookUP() that can check two factors before returning a value. I want to search for an identifier that is only unique for a given date.
I.E the Key exists multiple times in the dataset but only once for each date so the date and the key combined form a primary key.
Note: I want to do this without adding a column to the dataset.
This is a simplified example. I want a formula that will return 304 if I look up using 02/03/20 and 89076.
My current solution is to make another column that concatenates column A and column B and then do a Vlookup on the column but I am looking for a solution that does not require adding another column.
Using Excel 2010
In Excel 2010, if you not looking for a figure but actual text, try the following:
=INDEX(D:D,MATCH(1,INDEX((A:A=DATEVALUE("02/03/20"))*(B:B=89076),),0))

Summing the Non-Null results in a matrix

I have a report that looks like the picture below. It is a matrix with person name on the rows and weeknum on the columns. What I need to calculate is the number of weeks that have data in the calls taken column. In the picture below it is the consistency column with the red numbers. I can't seem to get those red numbers to appear. Is there an expression that can count the number of columns that aren't null in a particular matrix. This report will be dynamically generated and the number of weeks will be totally different each time.
I would rather solve this in SSRS because I don't want to mess with my SQL too much but if no SSRS solution is possible I can post my SQL and perhaps solve it that way.
You need to create a column group outside of the last group. So in your example, Right click on the column tab above your efficiency column in the 23rd week. After you create this column, you can use a simple Count(Fields!CallsTaken.Value) in an expression to count the times there are values listed.
Reference SO question on Horizontal Totals.

How to group rows (bassed on CustomerID) using Pivot in SSIS?

I am practicing SSIS and currently working on Pivot transformation. Here's what i am working on.
I created a Data Source (Table name: Pivot) with the following data.
Using SSIS, i created a package for Pivoting the data to have the following columns
PersonID --- Product1 --- Product2 --- Product3.
Here's where am at, I was able to create the pivot data to text file. But The output is not grouped by PersonID.
My Current Output is
As we can see the Transformation does not group the based on
SetKey(PersonID : PivotUsage =1)
The output i am hoping to get is
Where the data is grouped based on PersonID.
What am i missing here?
Edit:
Going back to the example i was following, I re-ordered the input data as follows.
Does the Input data need to be in this order/pattern, every time? Most of the examples i came across follow the similar pattern.
Yes, the input data needs to be sorted by whatever you're pivoting on:
To pivot data efficiently, which means creating as few records in the
output dataset as possible, the input data must be sorted on the pivot
column. If the data is not sorted, the Pivot transformation might
generate multiple records for each value in the set key, which is the
column that defines set membership. For example, if the dataset is
pivoted on a Name column but the names are not sorted, the output
dataset could have more than one row for each customer, because a
pivot occurs every time that the value in Name changes.
That's a direct quote from the Pivot Transformation documentation on MSDN. (Emphasis added.)
When I first read this answer, I thought that the sorted column should be the one with PivotUsage=2 in the pivot. That's what I understood the pivot column to be. However, what finally worked for me was to sort by a column with pivot usage=1. It's a column I would group by if writing the sql by hand.

Resources