Is there any way to make a dynamic formatting with query? - google-sheets

I have a complex sheet made by a query, and I would like to combine colors and borders to make easier to use. But as the size of the tables changes dynamically, I guess I have to add something like format commands into the query formula. But I donĀ“t know if that is possible. For example, changing the colors of column A depending on the Values of column B. Or defining the external borders of a table although the size of the table is not always the same.

no, this is not possible to manage from QUERY
for color change, you will need to use Conditional formatting (with custom formula if it's more complex)
and I guess you should give up on border color change as well as marge cell dynamicity (this can be controlled only by a script and even then it's tricky)

Related

libxlsxwriter multiple formats on a cell

First time poster, long time reader!
I am using libxlsxwriter in C.
I want to color rows either green or red and give the columns a different format each (which is either a date, a 2 decimal number or a 7 decimal number, or default.
the problem is that only the later is applied to each sell. so if do:
worksheet_set_column(bla, bla, bla, date_format)
//later in a loop:
worksheet_set_row(bla, bla, bla, green_format).
the cells will only have the green_format but the the date_format
is there a way to apply both?
I have a very messy solution where i just make red and green variation of each format, i.e. date_green_format/date_red_format. but that is really messy and i would like to avoid it aat all cost.
Is there a better way?
Thanks!
First use worksheet_set_row() and then use worksheet_set_column().
As per the documentation,
The format parameter will be applied to any cells in the row that don't have a format. As with Excel the row format is overridden by an explicit cell format.
Refer: worksheet_set_row()
is there a way to apply both? I have a very messy solution where i just make red and green variation of each format, i.e. date_green_format/date_red_format. but that is really messy and i would like to avoid it aat all cost.
Unfortunately that is the only possible solution. In Excel a cell that is at the intersection of a row and column format has a separate cell format that is a combination of both. As such, with libxlsxwriter you will also need to create and add a cell format that is a combination of the row and column formats.

Is there no way of including font color when returning data using IMPORTRANGE or VLOOKUP?

I know these functions don't normally work this way, but this is the only option I can think of with what I need to accomplish. Just please if anyone knows of a way that importrange can also display even just the font color from the source sheet (cell fill doesn't matter), that would be very helpful.
unfortunately no. IMPORTRANGE is not capable to carry on the formatting. but you can copy-paste it by clicking on the red circle and:
Google Sheets considers formulas and raw data to simply be values inside the cells, and it considers formatting to be visual prettiness for people. So, there's no formula which can affect a format, nor is there a format which can affect a cell's formula/data.
However, you can use Conditional Formatting to automatically format a wide range of cells in various ways. If your goal is to have this spreadsheet apply format to itself automatically based on its cells' values, this is probably what you want.
As a plus, the "Paste format" button works with Conditional Formatting too!

Google Spreadsheet Query; Keep Background Color

I have a spreadsheet with a whole bunch of data, where parts of it are queried to present in more readable ways. The problem is that the initial data also has background colors set, which are not taken over by the query result. Is there an easy way to do this?
Unfortunately this is not possible, because formulas do not transfer background colors. the only way is to use script, or set up some conditional formatting rule.
the easiest way would be to use conditional formatting to re-create the background color. custom formula would be:
=D1="test1"
applied to range D1:D

Conditional formatting based on previous cell

I have a list of times in a table that I want to apply some conditional formatting to. I just want them to turn different colours based on whether they're later or earlier than the time in the previous cell. I'm having trouble figuring out the appropriate rule though.
More specifically I'm having trouble thinking of a formula for the rule that I can apply to the whole range of times given in the table. What I need is basically the condition =[current cell]>[current cell-1] and vice versa but don't know how to write this in a formula that I can apply as a rule for the whole range.
How to accomplish this?
Custom Formula:
=B1<A1
Apply to:
B1:Z1
or
B:Z
Color:Green
Add another conditional formula for Red.
See explanation here

How to conditionally format highest value of multiple ranges

I'm trying to use conditional formatting to highlight the maximum value over multiple ranges. That is, find the one highest value in said ranges and highlight all instances of it. I have been able to use conditional formatting to highlight the highest number of one column, but not over multiple.
The ranges in question are: G3:G13,J3:J13,M3:M13,P3:P13,S3:S13,V3:V13
Screenshot of the spreadsheet
The versions I have tried either highlight every value in the first row, multiple values but not the highest one, or nothing at all.
An alternative is to use a MAX function and place that value in another cell (the little 4 in the bottom right corner) and use conditional formatting based on that value. However, it's not a particularly elegant solution nor have I been able to make that work properly.
I am using New Google Sheets and am familiar with custom formatting and custom formulas for doing so.
You need to use Conditional Formatting Custom Formula.
Set Apply to Range
G3:G13,J3:J13,M3:M13,P3:P13,S3:S13,V3:V13
Enter in Custom Formula is
=G3=(max($G$3:$G$13,$J$3:$J$13,$M$3:$M$13,$P$3:$P$13,$S$3:$S$13,$V$3:$V$13))
Pick your formatting style.
You may have to scroll down the Format cells if menu to find Custom Formula.

Resources