How to text wrap some cells in a google sheet column? - google-sheets

I have a google sheet, wherein the first two columns are filled using "Arrayformula" from a pivot table. Is it possible to merge some of the cells in first column while using Arrayformula.
Below is an image of sample data which I am obtaining from the pivot. I would like to have "Porsche" from 1st column to be text wrapped for all its corresponding customer IDs.
https://i.stack.imgur.com/Pdt4I.png
Thank you

You can try using query to filter out rows where there are no Customer IDs.
Formula:
=arrayformula(query({A1:B}, "where Col2 is not null"))
Output:
If this isn't the one you want, kindly provide your expected result as I'm unsure with how you used the term "text wrapped"

Related

Google Sheets - Query Table with output corresponding to specific cell criteria

I am trying to create a query based on a date range, that will display output based on the values in another column.
Here is the sample dataset I'm working with.
I would like the # Allotted (Column F) to be queried into 2 separate columns, depending on whether the Cost = 0. If the Cost = 0, I want the # Allotted to be listed under column "Free Trial" - otherwise, it should be listed under "Purchased."
I tried to create 2 separate queries for the "Purchased" and "Free Trial" columns but I can't figure out how to tell it to list the output based on a key value, such as Customer.
You can see my attempt in the sheet attached as well as what I'd like the output to look like. I highlighted the columns I'm having trouble with.
Thank you for your help!
Try:
={query(
{query({A:J},"select Col1,Col3,Col9,Col6,Col7 where Col7 =0 ",1);
query({A:J},"select Col1,Col3,Col6,Col9,Col7 where Col10 > date '"&text(A2,"yyyy-mm-dd")&"' and Col10 < date '"&text(B2,"yyyy-mm-dd")&"' and Col7>0 ",1)}
,"where Col2 is not null order by Col3,Col4 label Col1 'Customer',Col2 'Type', Col3 'Purchased', Col4 'Free Trial', Col5 'Cost'",1)}
I figured it out! Ended up using Filter instead of Query so I could filter based on the criteria selected.
I updated the solution to the sheet linked in the question.
For column "Purchased":
=iferror(FILTER(F4:F14,A4:A14=G19,J4:J14>=A$2,J4:J14<=B$2,G4:G14<>0),"")
For column "Free Trial":
=iferror(FILTER(F4:F14,A4:A14=G19,J4:J14>=A$2,J4:J14<=B$2,G4:G14=0),"")

Sheets formula for summing values with same name

I am trying to sum values for individual people who have multiple rows in one column and values (prices) in another. I am trying to have a column for the summed values for each person. Right now I am using =sum for each individual person but am looking for a way to code/use a formula to streamline the process.
use:
=QUERY(A:B; "select A,sum(B) where A is not null group by A label sum(B)''")

Google Sheets Combine a column with duplicates and update total sum in another colum

This might be something fairly simple but struggling to find a way to do it.
In Column B, I have a list of foods required.
In Column C, I have the amount needed.
In Column D, I have g (for grams) ml (for mills) etc.
I would like to combine the duplicates in Column B and update the totals from Column C, with the g or ml in Column D beside it.
The list I have has been created by using an array formula based on dropdowns in another sheet.
I have seen people using UNIQUE formula in 1 column (this works) and then a SUMIF formula in another column and then a JOIN formula in another... I tried this but the SUMIF is always returning 0.
Would someone please be able to advise on how I can do this?
TIA :D
It's hard to be sure exactly what you need without seeing the data. But based on my understanding of solely what you've posted, this QUERY formula should generate a condensed mini-report:
=QUERY({B2:D},"Select Col1, SUM(Col2), Col3 WHERE Col1 Is Not Null GROUP BY Col1, Col3 LABEL SUM(Col2) ''")
In plain English, this means "Arrange the data from the range B2:D in the same order as the raw data, but sum the second column's data according to matches in both the first and third columns. Only return results for the raw data where the first column is not blank. Replace the default 'sum' header on the second column with nothing; I don't need it."
This formula assumes that every ingredient will always be attached to the same measurement (e.g., 'salt' in Col B is always paired with 'mg' in Col D, etc.). If this is not the case, you will wind up with ingredients being listed as many times as there are different measures in Col D.

how to count something in multiple columns in google sheets?

I need to count items per person per date in google sheets. What formula do you recommend for?
I write this but it does not work:
=countifs(A2:A11, "3/14/2020", B2:B11, "person1", D2:H11, "*")
View image:
You could use a Pivot table
Have a look at the attached spreadsheet
https://docs.google.com/spreadsheets/d/....
Please read more about how to create and use Pivot Tables
Another way is to use the mmult method to get the row totals, then follow it with a grouping or pivot query:
=ArrayFormula(query({A2:B11,mmult(n(D2:H11="*"),transpose(column(D2:H11)^0))},"select Col2,Col1,sum(Col3) group by Col2,Col1"))
or
=ArrayFormula(query({A2:B11,mmult(n(D2:H11="*"),transpose(column(D2:H11)^0))},"select Col2,sum(Col3) group by Col2 pivot Col1"))
Since the range of first criteria is only one column, succeeding criteria should also use the same range, one column.
B2:B11, "person1", D2:D11, "*", E2:E11, "*" ...
reference: Each additional range must have the same number of rows and columns as the first range (criteria_range1 argument).

In Google Sheets, how to query and sum all values which have the same description?

I am using a query formula to import data from a different sheet.
However after querying the data, I got the same code which I need to sum the episode and the value with unique formula therefore after querying only show unique code. I'm not sure how to mix the formula.
My query formula is the following:
=QUERY(Paste!A:M,"SELECT A,B,C ORDER BY C DESC LIMIT 15")
My spreadsheet link is the following:
https://docs.google.com/spreadsheets/d/1A6lGIlU147Y_0WFD7Btkq4IMuY-Z3D1HsNiTgjLjm0o/edit?usp=sharing
As above image. Under column A I have same code for FMEM1 due to my raw data separate it for some reason. I don't want the same code separated. I want unique code not separated and sum the episode and sum the value
try
=query({A3:A17,B3:B17,C3:C17},"select Col1, Sum(Col2),Sum(Col3) group by Col1 label Col1 'Code',Sum(Col2) 'Total Episode',Sum(Col3) 'Total Value'")
Screenshot

Resources