Organize data with responses to questions in the next row - google-sheets

I have a form data where the information isn’t formatted equally.
The delimiter is : but the answer for some are added to the next row.
Example
———————————————————————
Subject: form number 123
———————————————————————-
————————————————————————
This is a space for messages
—————————————————————————-
—————————————————————
Age:
—————————-
36
——————————
—————————-
Country:
—————————
CA
—————————-
——————————
Color:
——————————
Red
——————————
I would like to have it formatted to have anything before : to be a header.
Subject | Age | Country | Color
How do would I achieve this with google sheet or any free tool out there?
I tried using sublime to format it but still running into the same issue with the answer being in the next row. Is there a way to redirect the answers to have : instead of next line/row.

Related

How do I "stack" columns in Google Sheets?

I have a spreadsheet in which each line represents a conference presentation. There are columns for the attributes of each presentation, including for up to six presenters with their names, degrees, city, state, email institution, and bio:
enter image description here
I'd like to repeat the speakers' data in a second sheet, stacking them, like so:
enter image description here
I've tried a few solutions, and think that this is the closest to working as I expect:
=TRANSPOSE(SPLIT(TEXTJOIN("~",TRUE,TRANSPOSE('Program Submissions'!N2:N),TRANSPOSE('Program Submissions'!X2:X)),"~",FALSE,FALSE))
With this formula at the top of each column (adjusted to reference the appropriate column in the other sheet), it gives me:
enter image description here
That's not correct, however. John Doe should only have an MD, and Jane Smith should have an MFA, MBA, and BA. But Jane's 2nd and 3rd degree cells were shifted upward into John's empty cells.
I"ve also tried this:
=UNIQUE({'Program Submissions'!N2:N;'Program Submissions'!X2:X})
and this:
={filter('Program Submissions'!N2:N, len('Program Submissions'!N2:N)); filter('Program Submissions'!X2:X, len('Program Submissions'!X2:X)); filter('Program Submissions'!AH2:AH, len('Program Submissions'!AH2:AH))}
Neither of which seem as good as the solution above, either throwing errors in cells or having other cell-shifting issues.
try:
={N2:W2; X2:AG2}
which could be extended:
={N2:W10; X2:AG10}
to ensure no blank rows:
=QUERY({N2:W; X2:AG}, "where Col1 is not null", )
more at: https://stackoverflow.com/questions/73767719/

Google Sheet: How to search & extract specific value from a long and multiple line of texts in single cell

Hello and good day everyone!
I need your help and advise, i've one set of table and data as per below, and i'd like to use a formula to extract specific value from a single cell by using some value as indicator to indicate which text's line to extract.
Given the sample table as below,
Column A
Column B
Column C
This is example of the long texts value with multiple linethis text is very long also included value as below,Company: Apple IncContractor name: John Wick the value above, is per line.. and this text continue.. continue text..example text again..
This is where i'd like to display the Company name extracted from Column A
This is where i'd like to display Contractor name extracted from Column A
Example of what i want to achieve,
Column A
Column B
Column C
This is example of the long texts value with multiple line this text is very long also included value as below,Company: Apple IncContractor name: John Wick the value above, is per line.. and this text continue.. continue text..example text again..
Apple Inc
John Wick
I've tried with
LEFT()
MID()
=LEFT(A2,SEARCH("Company",A2)-1)
=REGEXREPLACE(A2,"(.*)Company(.*)","$2")
with no success.
May I request your advise and help on this please!
Thanks in advance.
In your situation, how about the following sample formula?
Sample formula:
Retrieve "Company name".
=TRIM(REGEXEXTRACT(A1,"Company:(.+)"))
Retrieve Contractor name
=TRIM(REGEXEXTRACT(A1,"Contractor name:(.+)"))
Testing:
When these formulas are used, the following result is obtained.
Note:
For example, the base data is put to the cells "A1:A3", you can also use the following formulas.
=ARRAYFORMULA(TRIM(REGEXEXTRACT(A1:A3,"Company:(.+)")))
=ARRAYFORMULA(TRIM(REGEXEXTRACT(A1:A3,"Contractor name:(.+)")))
Reference:
REGEXEXTRACT

GAS - Concatenate Unique List + Sumifs

I am really struggling with this to come up with an easy way to do this in Google Sheets.
I need a unique list with filter.
Fairly straight forward:
Unique(Filter(UniqueRange,FilterRange,Criteria)
I need to sumifs that list. If i do it one row at a time, its fairly straight forward pointing one of my criterias to the result of #1 and copy it downward:
sumifs(SumRange, Criteria1Range, Criteria1, Criteria2Range, Criteria2))
What i am struggling with is, i do not know how far that unique list will go. So i do not know how far down to copy #2's formula. Its no big deal if i had unlimited rows but i need to output the results of the above to all show up in a single cell with a character between the results because i am trying to make all this fit in a "calendar" for a dashboard. Can this even be done?
Sample Data:
Apple | 2
Orange | 3
Red | 1
Green | 4
Orange | 5
Red | 2
Simple result i have now by letting the uniques list grow as needed on the left column and copying formula #2 downward on the right hand column:
Apple | 2
Orange | 8
Red | 3
Green | 4
My question again is, is there a way to have the below result all show up in a single cell and toss in a hyphen between the results?
Apple - 2
Orange - 8
Red - 3
Green - 4
EDIT:
Thank you all for the help.
#theMayer
You pointed me in the right direction and ended up solving my issue. Thank you!
#I'-'I
Helper columns will just not work for my needs.
What i ended up doing is modifying the solution a little. I modified it to have a " _ " between the data because the data had hyphens in it and it was confusing. As for the number formatting, ill just leave it out for now. Here is my final code along with an additional date filter in the select query:
ARRAYFORMULA(TRIM(CONCATENATE(QUERY({CHAR(10)&$G$3:$G,$F$3:$F,$A$3:$A},"select Col1,' _ ',sum(Col2) where Col3 = date '" & text(C3,"yyyy-MM-dd") & "' group by Col1 label sum(Col2) ''"))))
=ARRAYFORMULA(TRIM(CONCATENATE(QUERY({CHAR(10)&A1:A6,--("-"&B1:B6)},"select Col1,sum(Col2) group by Col1 label sum(Col2) ''"))))

Google Sheets: "Bob Smith" --> "bsmith" formula?

I'm trying to pull data from another Google Sheet to feed another Google Sheet. I need to pull from a full name field, which will have something like, "Bob Smith" and then I need to have it rewrite into the new Google Sheet as "bsmith".
Basically, "Get first letter of the first string, then concatenate the entire second string, and then make all lowercase."
So far I've gotten =LEFT(A28,1) working to grab the first letter of a string, but then not sure how to grab the second word and then concatenate.
To get the 2nd word you need to FIND() the first space then read from that position + 1 to the end of the string using MID(). & is used for concatenation.
=lower(left(A28,1) & mid(A28, find(" ", A28) + 1, len(A28)))
Try this for a Google sheet specific solution:
=LOWER(REGEXREPLACE(A2,"^(\w).*?(\w+$)","$1$2"))
It uses REGEX, a much more sophisticated engine and easily adaptable to variations than LEFT and/or MID.
Shorter:
=lower(left(A28)&index(split(A28," "),2))
(Assumes only ever two words.)

Google Sheets: Split data and delete first part of each new cell

I'm feeding data from a SAAS into a Google Sheet, and would need to format it a bit to be able to work with it.
Most columns are ok, but one column has multiple parameters in one. Each cell looks like (data anonymized):
affiliate_fees: None
affiliate_percent: 0.X
amount_refunded: 0
author_fees: 0
author_id: xxxx
author_percent: 0.5
coupon_id: xxxx
created_at: 2016-xxxxx
currency: USD
custom_gateway?: None
earnings_usd: None
meta: {u'url': None, u'class': u'transaction', u'image_url': None, u'description': None, u'name': u'xxxx'}
net_charge: xxx
net_charge_usd: xxx
paypal_payment_id: PAY-XXXXXXX
purchased_at: 2016-xxxx
refundable: True
sale_id: xxxx
status: None
stripe_charge_token: None
stripe_invoice_id: None
total_fedora_fee: None
total_processor_fee: None
user_id: xxxx
vat_fees: None
I've already found out how to SPLIT the data into different columns - I'm doing it via =SPLIT(CC2,CHAR(10))
Now what I'd like to do, ideally in the same operation, is to remove the part before the first colon :
So the goal is: ending up with only the values (part after the :) spread into different columns. I can manually enter the column names. For examaple:
--------------------------------------------------
| affiliate_fees | affiliate_percent |
--------------------------------------------------
| None | 0.X |
--------------------------------------------------
| ... | ... |
--------------------------------------------------
Any hints? Thanks for your time!
Note: I don't really need the meta: line, it can be discarded. I just left it in there because it might (or might not?) make things extra tricky
Alternative 1
Google Sheets introduced few months ago "Split text to columns" as a menu command. See Separate cell text into columns for further details.
Once you separate the text, you could use copy & paste > transpose
Alternative 2
A single formula alternative is to use
=ArrayFormula(transpose(REGEXEXTRACT(A1:A25,{"(.*[\w\?])+\:","\: (.*)+"})))
This will return an 25 x 2 array, and you will not have to manually add the column headers.
Alternative 3
If you still want to use SPLIT, you could use ": " as the separator and FALSE as the third argument to threat them as a single separator, but this also will split the meta: ... into several columns.
Assume that your data start at A1, then the formula to use is:
=SPLIT(A1,": ",FALSE)
To include all the rows with data, you will have to fill down this formula. Then do copy & paste > transpose.
In this spreadsheet I used this formula in cell E2
=ArrayFormula({regexreplace(split(A3, char(10)), "\:(.+)",""); regexreplace(split(A3, char(10)), "(.+)\: ","")})
This will create a row with headers and the values in row 2. If you don't want the headers, just use
=ArrayFormula(regexreplace(split(A3, char(10)), "(.+)\: ",""))
See if that works for you ?

Resources