grouped and alternating conditional formatting - excel

I have 3 sites, each of them have worked some tickets that I am reviewing. I would like to alternate between 2 shades of one color for each group: Site 1 would alternate between a lighter and a darker green, Site 2 would alternate between two shades of red, and Site 3 the same with Blue. However, I do not want to alternate every row, but rather every other ticket. The tickets may have a variable number of rows that are grouped with it. See screenshot where i have manually applied an example of the formatting im going for (these are not the final colors, these are used because the originals werent viewable after the image was uploaded).
Here is an image with the sample formatting:
Im fairly certain a helper column will be required here and while i'm fairly decent with excel and conditional formatting this one is a bit beyond me.

I will only use the Site column and Ticket column from your example to demonstrate my solution. Suppose the Site column is in Column A and Ticket column is in Column B, I will use Column C as the helper column in the following way presume the first row is for headers that do not need to be formatted:
In cell C2 enter number 1, this value is hard-coded/static;
In cell C3 enter the following formula and drag it down to the end of your table:
=MOD(IF(LEN($B3)=0,$C2,IF($B3=$B2,$C2,$C2+1)),2)
Then you should have a helper column showing either 1 or 0 based on the ticket number.
Highlight your table with cell A1 (i.e. the first cell of the range excluding header) being the active cell, set up the following conditional formatting rules one by one:
| Conditional Formatting Rules: | Format |
|-------------------------------|-------------|
| =(MAX($A$2:$A2)*10+$C2)=11 | Light Green |
| =(MAX($A$2:$A2)*10+$C2)=10 | Dark Green |
| =(MAX($A$2:$A2)*10+$C2)=21 | Light Red |
| =(MAX($A$2:$A2)*10+$C2)=20 | Dard Red |
| =(MAX($A$2:$A2)*10+$C2)=31 | Light Blue |
| =(MAX($A$2:$A2)*10+$C2)=30 | Dark Blue |
Then you should have the following:
Please note Column D Rule is for demonstration only which is not necessary in the actual table. It shows you how my formulas have differentiated each row based on Site and Ticket.
EDIT #2
Given that the Site ID are actually texts rather than numbers, here is an alternative approach, which is still using the helper column as illustrated in the original solution, but the conditional formatting rules will be changed to:
| Conditional Formatting Rules: | Format |
|---------------------------------------------------------------------------------------------|-------------|
| =(INDEX($A$2:$A2,AGGREGATE(14,7,ROW($A$1:$A1)/ISTEXT($A$2:$A2),1))&"#"&$C2)="Site Name 1#1" | Light Green |
| =(INDEX($A$2:$A2,AGGREGATE(14,7,ROW($A$1:$A1)/ISTEXT($A$2:$A2),1))&"#"&$C2)="Site Name 1#0" | Dark Green |
| =(INDEX($A$2:$A2,AGGREGATE(14,7,ROW($A$1:$A1)/ISTEXT($A$2:$A2),1))&"#"&$C2)="Site Name 2#1" | Light Red |
| =(INDEX($A$2:$A2,AGGREGATE(14,7,ROW($A$1:$A1)/ISTEXT($A$2:$A2),1))&"#"&$C2)="Site Name 2#0" | Dard Red |
| =(INDEX($A$2:$A2,AGGREGATE(14,7,ROW($A$1:$A1)/ISTEXT($A$2:$A2),1))&"#"&$C2)="Site Name 3#1" | Light Blue |
| =(INDEX($A$2:$A2,AGGREGATE(14,7,ROW($A$1:$A1)/ISTEXT($A$2:$A2),1))&"#"&$C2)="Site Name 3#0" | Dark Blue |
Here is the screen-shot:
Let me know if you have any questions. Cheers :)

Related

Data Bar calculated from another cell (Conditional Formatting)

In Excel 2016, I've been using conditional formatting's 'Data Bars' to make progress bars in a task register. I don't enough reputation to post an image, but imagine a table like this with data bars in the right column:
+---------+----------+
| Project | Progress |
+---------+----------+
| Task 1 | 40% |
| Task 2 | 20% |
| Task 3 | 100% |
| Task 4 | 80% |
+---------+----------+
Would it be possible to have the data bar display in the Project column instead?
Unfortunately, data bars need to get their data from the cell in which they exist.
However, a couple workarounds/alternate methods:
You could overlay a bar chart, removing all the backgrounds, borders, axes and gridlines, and setting the bar colour to be 60%+ transparent.
(Source)
You could use conditional formatting to display a solid color or gradient fill in the alternate cells.

Find Matching Word, or Number, in a Column and return corresponding rows

I'm not sure how well I'm going to articulate this, but hopefully, it makes sense.
I have a Google Sheet that houses 3 tabs, 2 of which hold data while the 3rd is an overview of the 2. I'm trying to create a small search formula to easily find specific data from 1 of the 2 sheets.
Here is how one sheet looks:
A B C D
1| Name | Number | Type | Role
--------------------------------------------
2| John Doe | 012345 | Tech | MKT
3| Jane Doe | 012445 | Business | DEV
4| Jane Doe | 012445 | Business | MKT
5| Arthur | 015475 | Home | SALE
6| Arthur | 011111 | Tech | MKT
And there are about 250 rows.
What I'm trying to do is see if a specific column matches the search term added to the primary sheet.
E.g: "Arthur" in Column 1 ("Arthur" A2:A5). And, if it exists, return the data from each column in the corresponding row.
E.g: Data returned would be:
A5 (Arthur), B5 (015475), C5 (Home), D5 (Sale)
Currently, I'm using the following formula in the main sheet which searches column A in Sheet 2 (A1 is the cell where I'm typing the name, e.g: Arthur) and outputs the first row:
=Vlookup(A1,Sheet2!$A$1:$K$200,1,False)
If there is a Match, the contents of that Cell is output. In this case, Arthur.
So, is there any way of extending this to also get the contents of all Cells in the matching Row?
But, I need to ensure it's going to be compatible in the event that this file is opened in MS Excel.
Thanks
EDIT: I've managed to solve my own problem:
=IFERROR(INDEX(Sheet2!$A$1:$K$20,SMALL(IF(Sheet1!$A$1:$K$20=A2,ROW($A$1:$K$20)-ROW($C$1)+1),ROWS(A$1:K1))),"False")
However, this does not work for Duplicates.
Let's so, there are 2 Arthurs, this will only return the corresponding row for the last instance of Arthur it finds. Is there a way to have it return all of them.
Please find the below formula & the image. Hope the formula will solve your issue.If still, the problem exists please share a Sample sheet with some Sample data. I will try to resolve your issue.
Formula - =QUERY(A3:D8,"Select A,B,C,D where A = '"&F2&"'",0)
Image for reference -
If you want to include the headers please replace 0 with 1.
The simplest is the filter function. Please try:
=filter('Sheet1'!A:D, A:A = "Arthur")
Or a query function.
NOTE! query and filter are not compatible with excel.
For excel you may adopt this formula for your needs:
=INDEX('Sheet1'!B$1:B$500, SMALL(IF("Arthur"='Sheet1'!$A$1:$A$500, ROW('Sheet1'!$A$1:$A$500)-ROW('Sheet1'!$A$1)+1), ROW('Sheet1'!1:1)))
Drag it down and right to adjust the result.

Excel: retrieve data based on a column

I have an excel document with a checklist like this one:
| number | yes/no | notes |
| 1 | yes | blablabla |
| 2 | yes | twinkle twinkle |
| 3 | no | little star |
I'd like to "echo" the fields which are set as "no" (in the second column) in another sheet, echoing the columns "number" and "notes". The result of my example would be:
| number | notes |
| 3 | little star |
How could I do it? Thanks!
Assuming your Main Table is in Sheet2, range A2:A4 (row 1 being headers). Use this formula, as an array (enter with CTRL+SHIFT+ENTER) in your sheet 2:
=INDEX(Sheet2!A$2:A$4,SMALL(IF(Sheet2!$B$2:$B$4="No",ROW(Sheet2!A$2:A$4)-ROW(Sheet2!A$2)+1),ROWS(Sheet2!A$2:A2)))
This will return all the Numbers. To get the Notes, change the very first index range to Sheet2!C$2:C$4. Obviously adjust your range down as necessary (I doubt you only have 4 of these).
Finally, just wrap an IfError() around that, so it looks nice when you use it. As you add data to your table, your table of only "no" values will update.
=IfError(INDEX(Sheet2!A$2:A$4,SMALL(IF(Sheet2!$B$2:$B$4="No",ROW(Sheet2!A$2:A$4)-ROW(Sheet2!A$2)+1),ROWS(Sheet2!A$2:A2))),"").
edit:
Screenshots:
(Using the IfError([above formula],"") wrapper hides the #NUM results when there's no match.)

Search a cell for multiple critera from a list and return a corresponding value from the list

This example should explain my question clearly
I have a huge table of values (50,000+ rows) in this format
PHRASE 1 | PHRASE 2 | VALUE
Sun | Blue | North
Moon | Green | South
Star | Red | West
I have a list of phrases in the format (again 50,000+ rows)
A B
1| Moon Fun Light Green |
2| Star Amazing Ball Red |
3| Sun Cat Inside Blue |
4| Star Dog Red Watch |
I need to search along the following lines - search A1 if you find a row where both PHRASE 1 & PHRASE 2 are present return the corresponding VALUE
Below is an example of how I would like the results would look. I.e. the search has checked to see if any of the word combos are present in the top table and returned the appropriate result if possible. There won't be an issue of two sets of positives i.e. Moon Fun and Light Green. The real values are all artist name and track name combinations.
A B
1| Moon Fun Light Green | South |
2| Star Amazing Ball Red | West |
3| Sun Cat Inside Blue | North |
4| Star Dog Red Watch | West |
A few notes:
The list of phrases to search are full of other text as well I.e. the cell will be the "The Moon was out tonight I was on the green hill". We need to search the phrase table, see if we find the combo of Moon & Green and if we do return the associated value.
I need to have multiple criteria in the search as a single search term doesn't narrow results enough, some of the words I'm searching are to general or are parts of other words (i.e. OFF is part of OFFLINE) which returns the wrong results where as searching OFF and another term simultaneously resolves that issue.
The list of phrases isn't in a set format, so I can't really exact all the values by splitting the columns i.e. it's not all "Moon - Green"
The closes I have come to solving this is using this formula:
IF(AND(ISNUMBER(SEARCH(C2,E2)),ISNUMBER(SEARCH(D2,E2))),B2,"")
Where C2 & D2 are the values to search, E2 is the box to search in & B2 is the value to return. The problem with this formula is that I'm limited to searching 1 combination at a time I.e. check C2 & D2 rather than saying check an array of C2:C100 & D2:D100
I've tried making that formula into an array with no luck.
I've also tried this formula:
=IFERROR(LOOKUP(2, 1/(ISNUMBER(SEARCH($L$7:$L$8, E2))), $K$7:$K$8),"")m
But in this situation it can only handle one critera (i.e. only search for Phrase 1) not both Phrase 1 and 2. $L$7:$L$8 is the list to search, E2 is the box to search in, $K$7:$K$8 is the corresponding value to return.
Hopefully that is enough to go on.
If you are happy to add an extra column to each dataset, then this will work:
Add an index column on your first table of values containing just a
number going from 1 to 50,000+
Add this array formula on your phrase sheet
{=SUM(ISNUMBER(SEARCH(L$2:L$50000,E2))*ISNUMBER(SEARCH(M$2:M$50000,E2))*P$2:P$50000)}
(where L and M are the columns containing your phrases and P is the index column)
Use the result of this column in a lookup.
As suggested below, if you can't (or don't want to) add a column to your first worksheet, you could change the formula to
{=SUM(ISNUMBER(SEARCH(L$2:L$50000,E2))*ISNUMBER(SEARCH(M$2:M$50000,E2))*ROW(L$2:L$50000))}
And use OFFSET to return the correct entry from your VALUE column.

Isolate Rows that Contain Certain Values in One Column (Excel)

I need help with what I think is a simple Excel formula or function. I have two columns. As an easy example let's say the first column is numbers and the second column is colors:
| 1 | Red |
| 2 | Blue |
| 3 | Red |
| 4 | Red |
| 5 | Green|
| 6 | Brown|
Let's say I just wanted the rows with red in the second column and have everything else on the sheet deleted. How would I do that? To be clear, I want the values in column one to remain as well. This is how I would like it to look:
| 1 | Red |
| 3 | Red |
| 4 | Red |
It seems like it should be simple but I can't seem to find any way to do that. There are similar question on the forum but they are more complex than what I'm asking and require super long formulas. If that's what is required, I suppose that's what I'll do but just wanted to see if there was an easy way to do it as well. Thanks for the help!
You can use autofilter to filter the second column. Then select and copy the visible cells only, remove the filter, delete everything and paste what's in the clipboard.
Or do you need a dynamic solution? Then you could build a pivot table on a separate sheet. Put the desired color in the page filter and refresh the pivot table when the source data has changed.

Resources