Two format number in a same cell - google-sheets

Could you tell me, if it is possible to have two number format in one cell?
The number format will change depending on the result of another cell.
I attach the link to my test file

Have a look at the TEXT() object's help document: https://support.google.com/docs/answer/3094139?visit_id=1-636271325324199875-441828486&hl=en-GB&rd=1
I added the solution to your spreadsheet in cell H5:
=IF(B11="x";TEXT(C11;"0.00 €");TEXT(C11;"hh:mm:ss"))
Each TEXT's 2nd argument is updatable, i.e. you could have either: "0.00 €" or "€ 0.00" or "hh:mm" etc.

Related

How to conditional format each row of a column based on corresponding value in another column

Please refer the image
I want the cell to be highlighted based on the value is less than or greater than the value in the benchmark column. I am not able to do that using conditional formatting custom formula. I have manually applied formatting for 02/01/2023 . I want the formatting to apply to the column with date = today() only.
Thanks :)
I can write a custom formula for each row of each date column. But is there any way a single custom formula that could format across rows and columns?
I'm guessing your fist value of 02/01/2023 and Activity1 is C2. Then for the whole range C2:Z (or whichever you have):
=C2>=$B2
Do this for one color for the whole range and it will drag automatically, you don't need to write it as an arrayformula. The "$" will always refer to the value in column B from the row it's positioned
if you are selecting whole range (C2:Z), try this for green and red respectively:
=(C2>=$B2)*(C2<>"")
=(C2<$B2)*(C2<>"")

Conditional formatting based on another cell's value applied to date ranges

Hi there, I'm trying to create an assessment calendar like the one above. Teachers will add in a start and end date and the corresponding boxes will be highlighted. I'm trying to figure out the formula for this in conditional formatting as the correct date along the range of dates in the year need to be highlighted. Each teacher needs their own section for inputting their assessments and I'm not sure how to put in the formula properly. I will use a drop down menu for teachers to select dates... would anyone be able to help with this? I tried following this guide but I'm not sure if it applies: https://stackoverflow.com/questions/20545961/conditional-formatting-based-on-another-cells-value#:~:text=Add%20a%20comment-,20,So%20this%20answer%20is%20meant%20for%20completeness%20to%20the%20previous%20ones.,-It%20should%20demonstrate
I tried using the $ in front of my cells but the color doesn't seem to change.
I tried =E34=45033 which changes that cells color, but it means I have to do a different formula for every cell. 45033 corresponds to the date 2023/04/17
In this Sample, D2:T2, A3:B are all date format.
Apply range of the conditional formatting is: D3:T
The formula of the conditional formatting is as simple as:
=AND(($D$2:$T$2>=$A3),($D$2:$T$2<=$B3))
You can format te date value of D2:T2 into any format as you like, just make sure those cells contains a date value.

How can I add multiple formulas to a long text cell?

I have a cell in a Google Sheets doc that is the template HTML for an e-commerce webpage. It's very long as there's lots of content on the webpage, and of course, the whole cell is a text format because HTML is text. I want to be able to have that HTML text look up other cells in the spreadsheet to populate parts of the HTML with values I have typed in other cells. So if my HTML is in cell A1 and in one part of it it says =B1 (or whatever you end up telling me) I want to be able to type Apple in cell B1 and have the HTML text replace =B1 with apple. Is there some way that, within a text format cell you can signify to Sheets "this next bit is a formula"? Basically, what should I type instead of the =B1 I used above to make this lookup work? Remember this is all in a text cell.
I've tried various ways of doing this but all seem to rely on having the cell in formula format, but this is not possible as I need to do this lookup process many times in a single cell with a large amount of text in it.
It looks that are asking about how formulas work in Google Sheets, specifically how formulas handle text values.
In Google Sheets, a formula start with = or +. As you question is about text values, the you should use =.
After the = your could add a quote enclosed text like ="apple". If your text include quotation marks, then you should escape them. Let say that your text is "apple" then the formula to use is ="""apple""".
Let's do a jump.
The concatenation operator is &. Let say that you have ="""apple"" ""orange""" on one cell, and grape in cell A1. To put a reference to A1 in order to insert it's value between the quoted fruits, the formula to be used is ="""apple""" & A1 & """orange""".

Value contains many text in Conditional Format Rules Google Sheet

I want to set conditional format rules in my Google spreadsheet. For the format cell, I select "Text contains", then I type values "PA, MA, CT, NY", formatting style I choose red. When I click DONE, the columns containing these words didn't show the color. I don't want to create rules "PA', "MA", "CT"and "NY" one by one. How can I fix them? Thanks for helping.
Select the relevant range (I am assuming starts at A1) and clear any existing CF rules from it. Format, Conditional formatting..., Format cells if... Custom formula is and:
=regexmatch(A1,"PA|MA|CT|NY")
with red fill and Done.
This should format any cells that contain any of the four state abbreviations (that is, both as part of the content of a cell and as all the content of the cell). It should format PACT but being case sensitive not many.
Try using OR with custom formula like this:
=or($A2="PA",$A2="MA",$A2="CT",$A2="NY")
As Ed said, but to clarify,
Go to conditional format and select 'Custom formula'
Assuming that your values are in column A, set the range to A1:A and enter the formula =OR($A:A="PA",$A:A="MA",$A:A="CT",$A:A="NY") in the custom formula field.
If the values are not in column A then change the formula as necessary.

How can I check if the values of multiple cells are equal?

Let's say I have 6 different cells (that are not all in a line). I want to check if the values in these cells are equal. How could I do this with a function? I'd want the function simply to display "EQUAL" or "NOT EQUAL" (or maybe change the cell background color?).
One option for 6 cells would be this:
=IF(AND(A1=B2,B2=C3,C3=D4,D4=E5,E5=F6),"EQUAL","NOT EQUAL")
Another option - this way you don't need to reference the same cell twice:
=IF(AND(ARRAYFORMULA(A1={B2,C3,D4,E5,F6})),"EQUAL","NOT EQUAL")
If you wanted to color some cells if values in these cells are equal, you would need to create a Conditional Formatting rule with a similar formula:
Select the cells you want to color
Format > Conditional Formatting
Select "Custom formula is"
Fill in one of the above formulas without the IF part of formula, e.g.
=AND(ARRAYFORMULA(A1={B2,C3,D4,E5,F6}))
Select the formatting style (color)
Done
as formula for conditional formatting:
=countunique({A1,B2,C3,D4,E5,F6})=1
as function it would be similar: =if([formula],"EQUAL","NOT EQUAL"):
update: the requested clarification:
put the wanted cells in a custom array {A1,B2,C3,D4,E5,F6}
(delimiters: , = new column, ; = new row; for countunique either is fine)
get the unique values countunique(...)
if the outcome is 1 then all values are the same
update 2: original answer used =count(unique(...)) instead of the combined function =countunique(...)
Here's an option without using an array that is easier to implement for large numbers of cells:
=IF(MIN(A1,B2,C3,D4,E5,F6)=MAX(A1,B2,C3,D4,E5,F6),"Equal", "Not Equal")

Resources