Spreadsheet Conditional formatting to hightlight duplicate that came in sequence - google-sheets

Greeting
I'm sorry for the intrusion, but I have a question that seems no one asked before.
I want to know if there is a formula for Conditional Formatting in spreadsheet to highlight certain cell, if a duplicate of certain text came in sequence in the same row.
A B C D E F
26 27 28 29 30
deni V X X V X
In the above example, I want to highlight the name "deni" when there are 2 "X"'s that came in sequence, which was the case at the 27 and 28 date.
Is there any formula for this? I have tried =OR(B2=C2,C2=D2) but it only works for 2 cells (B2&C2) with any text (not the "X" only).
Here is an example of the spreadsheet
PS: i'm sorry, i used excel tag before. but i need this formula to work in google spreadsheet. my bad, sorry
Conclusion: My Question have been answered, i used both formulas from I'-'I and Tom Sharpe and it worked like a charm. Many thanks to the people that responded My Question :)

=SUMPRODUCT((D2:AG2="x")*(E2:AH2="x"))
Apply to:
A2:A

Also
=countifs(D2:AG2,"x",E2:AH2,"x")

If you want to check if there is a duplicate text (not the "X"), you can use:
=IF(SUM(COUNTIF(D2:AH2,D2:AH2))>COUNTA(D2:AH2),1,0)
1 means true, 0 means false. This is because if there is at least one duplicate text, the sum of all the texts' appearance times will greater than the count of all the texts (if not they will be equal).
To be highlight a certain cell, here is deni, you can use Conditional Formatting -> Highlight Cell Rules -> More Rules -> use a formula to datemine which cells to format, and then paste the formula above in the cell.

Step1:Select the range of cells you want to apply conditional formatting to.
Step2:On the Home tab, click Conditional Formatting.
Step3:Point to Highlight Cells Rules, Go on More Rules...
Step4:Choose Use a formula... Paste the following one,
=SUMPRODUCT(COUNTIF(C3:G3,C3:G3)-1)>0
Step5:Format how you want to highlight
Step6:Click OK and Apply
Hope this helps you.
Note: Change the range in the formula as per your data.

Related

How do I add a 0 in front of a string of numbers for all cells?

I need to add a 0 before all cells in the A column on Google Sheets. Is there a code or formatting function I can add in? I need them to look like A2. A3 is what I have right now. There are a total of 783 that were extracted like this and I don't wanna do this manually
I tried formatting a few ways but I'm still a beginner in Sheets & Excel
You can try with ARRAYFORMULA in another column:
=ARRAYFORMULA(0&A1:A)
=INDEX(0&A1:A)
(PS: you may change A1:A with A1:A783)
If you want to just change the values in that column, you may use FIND AND REPLACE --> (Edit -> Find and Replace), be sure you tick "Search using regular expressions". Put to find ^ and to replace 0
NOTE: thanks to #rockinfreakshow, prior this second option, first format to plain text:
And then do the replacement:
You can use this formula in the adjacent cell:
Then you apply it across all your rows.
Do not forget to copy and paste as values.

SOLVED: Query a cell and return multiple results as string in another cell

I have a worksheet that calculates "begin date" (Column E) and "end date" (Column F) of an activity, then compares it to the "Ideal no. of days" (Cell H1) to decide if the process faced a delay.
Examples:
Activity 1 - Took 13 days, which 6 days more than ideal, and is therefore LATE.
Activity 2 - Took 4 days, which is less than ideal period, and therefore is NOT LATE.
How can I get both results in just one cell?
Ideal state would be:
Activity 1 output - LATE (-6)
Activity 2 output - NOT LATE (3) / ON-TIME
How it looks on google sheets
Edit: Added formula currently in use. It can also be seen on the screenshot.
=IF(G4>7, "LATE", "NOT LATE")
I added a new sheet ("Erik Help"). In that sheet, I removed all of your individual formulas from G4:H and replaced them with one array formula in G3 and one array formula in H3. Each of these formulas will produce the header and all column results for their respective ranges.
The G3 formula:
=ArrayFormula({"Time Taken";IF(NOT(ISNUMBER(E4:E))+NOT(ISNUMBER(F4:F)),,F4:F-E4:E)})
The H3 formula:
=ArrayFormula({"Delay Status";IF(NOT(ISNUMBER(F4:F)),IF(NOT(ISNUMBER(E4:E)),,"IN PROGRESS"),IFS(F4:F-E4:E>7,"LATE (",TRUE,"ON TIME (")&H1-(F4:F-E4:E)&")")})
These formulas may seem "long" to some. They're really not, but they are longer than one might expect because they control for several likely error scenarios.
Here, I used the ampersand symbol for concatenation of the final "phrases" in H4:H.
Formula in Cell H8:
IF($G8>$H$1, CONCATENATE("LATE ", SUM($G8-$H$1)), CONCATENATE("NOT LATE ", 0))
I also updated your spreasheet Col K GoodJuJuand cell H8
If you are looking for a solution using Excel 365,
suppose you have given a name to the ideal date called Ideal_Days
you can try the following in cell H4 and drag it down to apply across:
=LET(x,Ideal_Days-G4,IF(x<0,"LATE ("&x&")","NOT LATE ("&x&")"))

Concatenate cells based on a condition

I look for the following: I have columns with part names that make up a particular product, where I inform if the parts are defective or not. When the part is OK the default information is set to "#". All defects have a depreciation value from 0 to 10.
I want to concatenate in one cell all the defects that depreciate the product. In another cell, the defects that do not depreciate.
Here's the test sheet:
https://docs.google.com/spreadsheets/d/1HX2eko7v15mDja6_KlajmUaHkY4SCmKfELvPxqgnDUA/edit#gid=0
Actually I got a solution, however, there are 18 columns and the formula will be very large. Could someone come up with a smarter solution?
Here's my current script:
=IFERROR(CONCATENATE(LEFT(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)<>0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)<>0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)<>0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)<>0;D2&", ";"");""));LEN(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)<>0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)<>0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)<>0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)<>0;D2&", ";"");"")))-2);".");"OK")
and
=IFERROR(CONCATENATE(LEFT(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)=0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)=0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)=0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)=0;D2&", ";"");""));LEN(CONCATENATE(IF(A2<>"#";IF(VLOOKUP(A2;$H$2:$I$5;2;FALSE)=0;A2&", ";"");"");IF(B2<>"#";IF(VLOOKUP(B2;$H$2:$I$5;2;FALSE)=0;B2&", ";"");"");IF(C2<>"#";IF(VLOOKUP(C2;$H$2:$I$5;2;FALSE)=0;C2&", ";"");"");IF(D2<>"#";IF(VLOOKUP(D2;$H$2:$I$5;2;FALSE)=0;D2&", ";"");"")))-2);".");"OK")
paste in D2:
=ARRAYFORMULA(REGEXREPLACE(TRIM(TRANSPOSE(QUERY(TRANSPOSE(
IF((A2:D<>"")*(A2:D<>"#"); A2:D&","; ));;999^99))); ",$"; "."))
paste in E2:
=ARRAYFORMULA(IF(B2:B<>""; IF(B2:B="#"; "OK" ; B2:B)&"."; ))
spreadsheet demo

Using arrayformula to autofill formulas for new entries- comparing cells in the same column

Relative beginner to using formulas in excel/google sheets, and I'm having some trouble figuring out how I can use an array formula to compare cells in different rows but the same column in google sheets (in my case, how I can do =IF(A3=A2,dothis,elsedothis) as an array formula. I'd also be interested if anyone has a different solution other than array formula to autofill formulas in.
The specifics:
I have a list of participants who've done an experiment, and some of them have done it multiple times. With a long list of participants and multiple entries for some participants, it's difficult to see where one participant's info ends and the next begins. So what I want is to alternate the rows in gray and white shading based off of the participant's number (ie. all of 001's entries in gray, all of 002's entries in white, 003's in gray, and so on). To do this, I put in a column on the right using a formula that checks if the participant number in the row above it is the same and, if not, it adds one (I'd like to use this to get a participant count later on). This is what the dataset looks like, and I've included the formula on the right.
A B ... ... X
001 9/1/16 ... ... 1 (1)
001 10/1/16 ... ... 1 (=IF(A3=A2,X2,X2+1))
001 11/1/16 ... ... 1 (=IF(A4=A3,X3,X3+1))
002 9/2/16 ... ... 2 (=IF(A5=A4,X4,X4+1))
002 10/2/16 ... ... 2 (=IF(A6=A5,X5,X5+1))
003 10/5/16 ... ... 3 (=IF(A7=A6,X6,X6+1))
...
All this is working fine and dandy, but the problem is, when I enter a new row, it doesn't automatically fill in the formula, and so the shading doesn't adjust. I suppose I could redrag down the formula every time I enter in new participant info, but that's tedious and I'm not the only one using it, so it's going to get messed up pretty quickly. From what I looked up, arrayformula is what I should be using. But you have to refer to the column as a whole if you use arrayformula. Anyone have any ideas?
Assuming you got the conditional formatting covered, I believe the formula(s) you use can be turned into one single array formula so that the output auto-expands when new rows are added. Example:
={1; ArrayFormula(IF(LEN(A3:A), offset(A2,0,0,ROWS(A3:A),1) + IF(A3:A = offset(A2,0,0,ROWS(A3:A),1), 0, 1),))}
See if that would work for you?
NOTE: the custom formula in conditional formatting used in the spreadsheet is
=AND($X1<>"", ISODD($X1))
One way to achieve the desired result:
To alternate the rows in gray and white shading based on the participant's number do the following:
Under the Format Menu choose conditional formatting
Enteries for the Conditional format rules dialog
In apply to range select the range e.g. A2:A16 (it may include blank cells)
For Format cell if choose Custom formula is
Type =isodd(A2:A16) in the text box below
For Formatting style choose Custom
Choose gray color from the fill button
Finally hit Done
To get a participant count you can use the formula =countunique(A2:A16)
You can do this alltogether without an additional helper column at all, just using conditional formatting:
The custom function to add into the conditional formatting option is this:
=isodd($A:$A)=TRUE
At the end if you still want your participant count, you can use this:
=COUNTA(UNIQUE(A:A))

Any way to highlight current date column in my google spreadsheet?

I have this planning sheet I am working on: https://docs.google.com/spreadsheets/d/1GQpZh0MOotBl_iAucGm_LnK8shIKjjgukGqaFVvGKF8/edit?usp=sharing
As you can see events are planned out on a sort of calendar look.
I will be using this every day and I would like it to highlight the current date to me automatically. I've highlighted today's date manually.
Do you see any way to do this?
It does not need to be the whole column it can just be the day number and week of day on the top if it's easier.
I would greatly appreciate any help you can give me regarding this!
Thanks a lot.
Balint
I found this question when searching for a way to highlight a whole column/row.
Here's the way to do it:
Apply to range: A1:Z1000 (this is the range of all columns/rows including the dates)
Format cells if...: [Custom formula is]
Formula (for columns): =A$1=TODAY()
Formula (for rows): =$A1=TODAY()
The dollar sign ($) will keep the reference cell fixed. So if the formula uses A$1 it takes A1, B1, C1 etc to look for the date and then highlights the entire column A, B, C etc.
If the formula uses $A1 it takes A1, A2, A3 etc to look for the date and then highlights the entire row 1, 2, 3 etc.
Just make sure that "range" covers the entire rectangle of cells and not just one date. It's easy to adapt if your dates are in a different row/column.
Hope this helps the next person who comes here with a similar problem :)
You would have to use conditional formatting
on the column with the dates. Rule should be "Date is today". Choose a color to your likings.

Resources