Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9843

Pretty print google sheet formula?

$
0
0

Finding answers on Web Apps SE or Reddit is wonderful, but if you don't understand them you can't modify them.

I recently came across the following as part of an answer:

={"Corrected List 2";ArrayFormula(IF(LEN(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(REGEXMATCH(E2:E,"("&TEXTJOIN("|",1,FILTER("(?i)"&A2:A,LEN(A2:A)))&")"),REGEXREPLACE(E2:E,"("&TEXTJOIN("|",1,FILTER("(?i)"&A2:A,LEN(A2:A)))&")","♥$1♥"),)),,1E+100)))),SUBSTITUTE(SUBSTITUTE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IFERROR(VLOOKUP(IFERROR(SPLIT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(REGEXMATCH(E2:E,"("&TEXTJOIN("|",1,FILTER("(?i)"&A2:A,LEN(A2:A)))&")"),SUBSTITUTE(REGEXREPLACE(E2:E,"("&TEXTJOIN("|",1,FILTER("(?i)"&A2:A,LEN(A2:A)))&")","♥$1♥"),"","♦"),)),,1E+100))),"♥",0,0)),{A2:A,B2:B},2,0),IFERROR(SPLIT(TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(REGEXMATCH(E2:E,"("&TEXTJOIN("|",1,FILTER("(?i)"&A2:A,LEN(A2:A)))&")"),SUBSTITUTE(REGEXREPLACE(E2:E,"("&TEXTJOIN("|",1,FILTER("(?i)"&A2:A,LEN(A2:A)))&")","♥$1♥"),"","♦"),)),,1E+100))),"♥",0,0)))),,1E+100))),"",""),"♦",""),E2:E))}

My mental parser is in overload. It doesn't help that is is in effect self writing code, with string versions of what would otherwise be reserved words. and that it uses google query.

The first step to understanding this is to tease it apart, and that, for me needs some kind of pretty printer. Google wasn't helpful.
One similar here: How can I pretty-print a formula in Google Sheets? is rather simplistic, is in VBA code and I don't thing understands the syntax overload of query.

The sheet was posted on reddit. https://docs.google.com/spreadsheets/d/1iMsMs8mPHFZIcBPV1vGzWEHd9RnO18VbdGwQ5HkR1ak/edit#gid=0

The formula is a green box Corrected List 2.

I asked a question there, that I had asked here. This sheet was in response to this question:

More compact version of nested substitute function possible?


Viewing all articles
Browse latest Browse all 9843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>