Much like the problem with the transposing of data in transpose column data I am stuck trying to transpose a set of data with multiple variables. The biggest issue I face is trying to remove useless data. Table 1 is how the data is received
Column N
Sep 07 2022
Alert
Something went wrong
fish company
70000123456
1234567
231.03
View Details
Sep 07 2022
---
meat company
70000987654
688773
View Details
Sep 07 2022
Success
produce company
70000192837
View Details
Table 2 is the desired output
Column A
Column B
Column C
Column D
Column E
date
vendor
po
Invoice
cost
Sep 07 2022
fish company
70000123456
1234567
231.03
Sep 08 2022
meat company
70000987654
D688773B
Sep 07 2022
produce company
70000192837
I was unable to trim cells Alert and Something went wrong due to nesting errors.
REDUCE the array to the string, joined by delimiters. If the value is a date, join by 🍚, else if it's a value of interest determined by REGEXMATCH, join by 🐇. From the created string, split by the row delimiter 🍚, TRANSPOSE and SPLIT by the column delimiter 🐇
=ARRAYFORMULA(SPLIT(TRANSPOSE(SPLIT(REDUCE(,A2:A20,LAMBDA(a,c,IFS(ISDATE(c),a&"🍚"&TO_TEXT(c),REGEXMATCH(TO_TEXT(c),".*company|70{5}\d+|\d+"),a&"🐇"&c,TRUE,a))),"🍚")),"🐇"))
Sep 07 2022
fish company
70000123456
1234567
231.03
Sep 07 2022
meat company
70000987654
688773
Sep 07 2022
produce company
70000192837
If you don't care about dragging formulas, you might be able to use something like the following steps I did:
Pasted your data starting in cell A2.
Put a formula for to identify dates to the right of your data starting in cell B2: =N(B1)+if(ISDATE(A2),1,0) (NOTE this formula isn't dynamic)
Create a unique list filter list cell D1: =UNIQUE(Filter(B:B,B:B<>""))
Used formula to parse out data next to unique list (so starting in E2): =Transpose(FILTER(if(A:A="Alert",,A:A),(B:B=D2)*(A:A<>"ALert")*(A:A<>"Something Went Wrong")*(A:A<>"View Details")))
As you can see in part 4, I tried to strip out members that you flagged as irrelevant. I'm not sure what other rules you have.
There's probably a way to make steps 2 and 4 dynamic spill formulas, but that's all I have time for.
Ended up with this (yellow cells have relevant formula).
Related
I have a column that goes from trip 01, trip 02, trip 03... up to trip 50, next to that column there will be an indicator where the current trip is, for example if is in line where is the trip 06, I want to create a helper column that will show trip from 01 up to current trip which is trip 06 and add trip 07 to it, in other words list all previous trips until current one and also next trip. Any thoughts?
I have a spreadsheet where I have been doing tests.
Spreadsheet
Would this be useful? It lists from A2 to the match of Current Trip +1 within INDEX:
={A2:INDEX(A2:A,XMATCH("CURRENT TRIP",B2:B)+1)}
I have a google sheet that grabs data from multiple web pages to list the next game for each team in the FIFA World Cup. I use the following to do so for the follow example of 2 teams. In reality I would like to grab for 5:
=UNIQUE({
IMPORTHTML("https://www.espn.com/soccer/team/fixtures/_/id/2869/league/FIFA.WORLD#","TABLE",1);
IMPORTHTML("https://www.espn.com/soccer/team/fixtures/_/id/475/league/FIFA.WORLD#","TABLE",1)
})
The problem is that sometimes teams get eliminated and don't have a next game, so the table is deleted from the webpage and an error is returned by the above function,
How can I trap the error on each IMPORTHTML call and return an empty row instead of the whole UNIQUE function failing. Here's what the data returns when it works properly.
DATE MATCH TIME COMPETITION TV Opponent
Thu, Dec 1 Canada v Morocco 10:00 AM FIFA World Cup FS1 Canada
Fri, Dec 2 Serbia v Switzerland 2:00 PM FIFA World Cup FS1 Serbia
Here's what I would like it to look like if the first IMPORT fails:
DATE MATCH TIME COMPETITION TV Opponent
Fri, Dec 2 Serbia v Switzerland 2:00 PM FIFA World Cup FS1 Serbia
Have you considered using an IFERROR for each IMPORTHTML so it doesn't affect the other values in the table? Like this:
=UNIQUE({
IFERROR(IMPORTHTML("https://www.espn.com/soccer/team/fixtures/_/id/2869/league/FIFA.WORLD#","TABLE",1));
IFERROR(IMPORTHTML("https://www.espn.com/soccer/team/fixtures/_/id/475/league/FIFA.WORLD#","TABLE",1))
})
You can read more about the IFERRORformula here.
I have a googlesheet (sheet 1) which looks like this:
contents contains a column with Months
May 2021
June 2021
July 2021
August 2021
September 2021
October 2021
November 2021
December 2021
January 2022
February 2022
March 2022
April 2022
May 2022
June 2022
Each month / cell in column A (sheet 1) all link to another sheet within the workbook containing the data for each month, all data has different rows, so to summarise each month, I want a formula like this:
=sumif(indirect(A4,&"!A:A"),"ProductA",(indirect(A&"!B:B")))
where A4 references January 2021, and this is linked to sheet January 2021, ProductA is in column A of each monthly breakdown (all sheets after sheet 1), and the number of these in column B.
I want to be able to drag this formula down, and have the sheet look for the sum of ProductA across all months, using Column A in sheet 1 to reference the sheet it should look in, i.e. the month.
Does this make any sense?
I can add more info, apologies for the waffle.
Sheet 2 for example contains Month1 data and looks like this:
Category (Ticket) Count Thread Time
prod1 5 22 8395:35:00
prod2 67 5411 644:24:00
prod3 544 55 18283:24:00
prod4 56 546546 97093:52:00
prod5 75 646 38238:11:00
Here is a formula that should work for you:
=arrayformula(sumif(indirect($A2&"!A:A"),C$1,(indirect($A2&"!B:B"))))
You can place this into cell C2, and then copy it down and across.
The issue with your formula was first that you had (indirect(A&"!B:B")), instead of (indirect(A2&"!B:B")).
Secondly, you need to make sure that there's no extra space after your values.
In the above image, you have an extra space after prod3, so when using the SUMIF and trying to match the value, it was not working. If something is resulting in 0 where it shouldn't be, make sure to check that first. I have found that prod4 and prod6 both have the same issue.
I have a spreadsheet where I'm tracking my net worth over time. Once a month, I add in my account balances.
In one sheet, I have this structure:
Date
Year
Net Worth
Account1
Account2
Account3
Jan 31, 2021
2021
$320
$200
$140
-$20
Feb 28, 2021
2021
$340
$200
$150
-$10
Mar 31, 2021
2021
$410
$250
$200
-$40
Apr 30, 2021
May 31, 2021
...rest of months for the year
The formula in the Year column is =if(C3<>"", year(A3), "").
The formula in the Net worth column is =if(sum(D3:F3)<>0, sum(D3:F3), "").
The Problem:
I'd like to have a cell which lists the greatest 1 month change (so $410 - $340 = $70), without having to update the formula every month. (In an ideal world, I never need to touch it again, only ever having to enter account balances once a month.)
What I've got so far:
=if(
abs(min(ArrayFormula(C3:C400 - C2:C399)))=max(ArrayFormula(abs(C3:C400 - C2:C399))),
min(ArrayFormula(C3:C400 - C2:C399)),
max(ArrayFormula(C3:C400 - C2:C399))
)
However, this includes the change from $410 to "", which is coerced to $0. So instead of the expected $70, I'm instead getting $410.
How can I get the greatest 1 month change, but ignore the empty string values?
Easiest way to fix it is just to put in an if clause I think:
=ArrayFormula(max(if(C3:C400<>"",abs(C3:C400-C2:C399),)))
because Max will ignore the empty string generated by the If statement
or slightly shorter:
=ArrayFormula(max((C3:C400<>"")*abs(C3:C400-C2:C399)))
so that the change for any empty cells is set to zero.
These assume that C2 itself is not blank!
I have a start date and an end date, and DATEDIF easily gets me the number of months within there. I'd like to write out each month within that range, e.g. for a date range:
Mar 1, 2016 - Jul 31, 2018
...I want to iterate over the number of months in that range and return a row for each month in the range, starting from the start date:
Mar 2016
Apr 2016
May 2016
(the rest of 'em)
Apr 2018
May 2018
Jun 2018
This may be a better illustration of what I'm after. This table shows my source, a sheet of unique subscriptions, each having an ID, a rate, and start and end date:
The table I want to generate automatically would iterate through each unique subscription ID row, and then give me a row for each months' subscription payment, across the start-end dates for that subscription ID:
This second table I just want to make dynamic and dependent on what's in that first table, to save time.
I understand I have to just put in the time and figure out how to do it like everyone else has, but if you know if this is even possible just using Google Sheets' standard functions and queries, I'd be filled with a renewed sense of hope.
Thanks in advance for any patient pointers.
I was curious if it is possible with a formula.
Here's the result:
=query({TRANSPOSE(SPLIT(TEXTJOIN("",1,TRANSPOSE(ARRAYFORMULA(TEXT(ROW(INDIRECT("a1:a"&MAX(FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))))*(TRANSPOSE(FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))>=ROW(INDIRECT("a1:a"&MAX(FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))))),"0"","";;")))),",")),
ARRAYFORMULA(TEXT(EOMONTH(
VLOOKUP(TRANSPOSE(SPLIT(JOIN("",REPT(ROW(INDIRECT("A1:A"&COUNTA(A2:A)))&",",FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))),",")),FILTER({ROW(A2:A)-ROW(A2)+1,D2:D},A2:A<>""),2,),
TRANSPOSE(SPLIT(TEXTJOIN("",1,TRANSPOSE(TEXT(ROW(INDIRECT("a1:a"&MAX(FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))))*(TRANSPOSE(FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))>=ROW(INDIRECT("a1:a"&MAX(FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))))),"0"","";;"))),","))-1
),"MMM YYY")),
ArrayFormula(VLOOKUP(TRANSPOSE(SPLIT(JOIN("",REPT(ROW(INDIRECT("A1:A"&COUNTA(A2:A)))&",",FILTER(DATEDIF(D2:D,E2:E,"M"),A2:A<>""))),",")),FILTER({ROW(A2:A)-ROW(A2)+1,A2:C},A2:A<>""),{2,4},))},"select Col1, Col3, Col2, Col4 label Col1 'Payment_Id', Col3 'Subscription_Id', Col2 'PaymentMonth', Col4 'PaymentAmount' format Col4 '$0.00'")
If you know js, It would be better to write a script using apps
script.