Sheets, conditional formatting - regex

I am looking to create a conditional formatting function that will highlight "C2:E2" if "E2" > 5000 & "B2" does not contain the word "treasury".
any help would be appreciated!

try on range C2:E:
=($E2>5000)*(NOT(REGEXMATCH(LOWER($B2), "treasury")))

Navigate in top menu to Format -> Conditional formatting
There you can specify range as E2:E29
Use conditional formatting with just one AND formula that refers dynamically to the values of the same row, but different column
AND comparision of the current value
=AND(indirect(address(row();column()-3))<>"Treasury";indirect(address(row();column()))>5000)
This can maybe be simplified, but definitely works with more conditions at once.
Some explanation:
To avoid typing new formulas for each row, we use INDIRECT joined with ADDRESS
column()-3 refers to current column (the one you call formula in) . Have in mind that means for each columns (C->E) you need a different formula that refers to another column for checking if it contains "treasury". In your case you'll need different formulas for column C,D and E. column()-3 works for E, because Treasury is in B column (3 columns earlier from E)
P.S: translating from my native language, so not sure if English UI is the same, but should be intuitive from here.

You'll want a custom Conditional Formatting Rule.
Click in cell C2, then from the menu choose:
Format > Conditional formatting
In the dialog box, set your range:
C2:E29 (or change 29 to whichever row is the last one you want to include in the formatting rule)
Under Format rules > Format cells if..., choose the bottom option from the dropdown menu: "Custom formula is."
In the field below, enter this formula:
=AND(NOT(ISNUMBER(SEARCH("treasury",$B2))),$E2>=5000)
Set your formatting style and click Done.

Related

Custom Column in Power BI

Can someone please help me with custom column code in Power BI Query Editor.
I wish to get a value "Latest" in custom column against "CRTG-0006" as 0006 is the highest number in the column. CRTG-0006 is the latest version of the Program CRTG & CRTG-0001 being the first version of the Program. In future, let's say if I add "CRTG-0007" file in the root folder, Custom Column return value shall be "Latest" for "CRTG-0007" and shall be "null" for "CRTG-0006" and all previous versions of the Program.
Given your layout,
Assume your program and versions column header is Program
Assume your preceding step is #"Changed Step
Then, in the Add Custom Column dialog you can use this formula:
if [Program] = List.Max(#"Changed Type"[Program]) then "Latest" else null
This works because your format is such that simple alphabetical sorting will work. The program name/abbreviation is always the same, and the version number is padded with zero's
By the way, if you have multiple programs in the Program column, I would group by the program base name, and apply the same algorithm in a custom aggregation.
It's a bit hard to tell what you want but you can right click then split the column on - to get the number. You can then convert type to numerical and sort or take the List.Max([ColumnName])

How to make Index & Match functions on GG Sheets match blank cells?

I have one table of data (A) with data values, and a second table (B) which serves as a key that categorises/groups those entries into categories.
I am trying to write a cell formula that will list the category that corresponds to the data value in (A).
Some of the entries in the data table are empty, i.e. have no input data.
Case in point:
A13 has an empty cell, according to table (B), I specifically want the blank cell to be categorised as "Other". At the moment the sheet thinks cells like these are "null" and not "blank" and therefore returns #N/A.
I have tried adding an IFERROR function, which works at this stage but does not suit the scenario where a new data entry is entered as that will initially show as "Other" too when it should be something else, so I want to avoid using:
=IFERROR(INDEX(D2:D13,MATCH(A2:A13,E2:E13,0)),"Other")
Current cell formula for col B:
=INDEX(D2:D13,MATCH(A2:A13,E2:E13,0))
Please can you help? I've found plenty of articles on how to ignore blank/empty cells, but nothing to include them.
Many thanks!
OH
Shared link of problem
Screenshot of problem
use ifna like:
=IFNA(INDEX(D2:D13, MATCH(A2:A13, E2:E13, 0)))
update:
=INDEX(IF(A2:A13="",,IFERROR(INDEX(D2:D13,MATCH(A2:A13,E2:E13,0)),"Other")))

CheckBox to Highlight Range Google Sheets Formula/ Google Sheets

I am trying to get the result in the image attached. If I check a checkBox in Column A, I want it to also to highlight the same SKU & Location Column H,I(in Bright Green). Conditional formatting or if script could do this?
try:
=REGEXMATCH($H2&$I2, TEXTJOIN("|", 1, FILTER($B$2:$B&$C$2:$C, $A$2:$A=TRUE)))
UPDATE:
=REGEXMATCH($H2, TEXTJOIN("|", 1, FILTER($B$2:$B, $A$2:$A=TRUE)))
You could simply achieve this using conditional formatting. These are the steps to follow:
Select the cell that you want to highlight with the checkbox, right click on it.
Go to conditional formation
Under Conditional format rules -> Format rules select custom formula is under (format cells if) and below it =A2 (or the checkbox cell basically)
Choose the color and press done and you will be ready!
Hope this has helped you, let me know if you need anything else (like an Apps Script implementation of this) or if you did not understand anything.

How to select multiple values from a filter in Google Sheets?

I've got lots of data in a Google sheet (I do not have Excel or Windows as I am on a Chromebook) and I want to use one column to filter out cells which contain two different words. The column of data might contain various values.
Example
Cell 1 Acme - Main - Location
Cell 2 Acme - Secondary - Location
Cell 3 Acme - Location - Main
Sticking with the above example, I would like to use my data filters set at the column headers to only show me cells where it matches Acme and Main.
What is the best way of doing this, please?
I tried using the Text Contains option in the data filter but I'm not sure how to insert both words as something to filter by, it seems to only filter the words exactly how they are typed. So if I type in Acme Main into the filter it will work for some cells which are in that exact order.
if the order of "acme main" combo does not matter you could use:
=REGEXMATCH(A1:A, "Acme(.+)Main|Main(.+)Acme")
if you also want it by any chance case-insensitive use:
=REGEXMATCH(LOWER(A1:A), "acme(.+)main|main(.+)acme")
In the filter options, use this custom formula
=regexmatch(A1:A, "Acme(.+)Main")
and see if that works?
Change column reference to suit.

How to put formula in Data Validation List Excel?

I am creating an excel sheet with following Data Validation drop down list.
NA
Done
(add some formula here)
Basically, i will be able to select either plain text "NA"/ "Done" from the dropdown list. But sometimes, I want the user to be able to calculate some values based on the cell respective to the row selected so, I want to have one formula as a choice inside the data validation dropdown list. Is this possible?
Data Validation List Source
When I click on Formulae option, it should execute the formula with respect to the cells in that Row
But currently, the formula that i put in doesn't execute, instead it will just show the whole formula in the cell when activated.
1)How can i make it so that when i select the formula from data validation list, it will execute it instead of filling up the cell with it?
2)How do i set the formula so that it will be using the cell from the current Row? (for example, if i am using the data validation List in N60, the formula should adapt itself to use the cell (let's say A60?).
I may not be able to help with the second part, but I was seeking an answer to the first and discovered a solution/workaround using Name Manager.
First, in Formula > Name Manager, create a new reference (the "refers to" will contain whatever formula you are wishing to ultimately display in the validation list. For this example, we use the formula reference "=IF($H54=..." and Name it "UniqueName"
Now, we go into Data Validation, Select List, and input the three items we want displayed in the list, with an equals sign preceding our newly named reference: ie. "NA,Done,=UniqueName"
Note: You can't start with the =UniqueName or validation will try to read it all as a formula and fail.
This method will allow the user to display "NA", "Done", or "=UniqueName" in the cell; if "=UniqueName" is selected, the cell itself will interpret this as a formula and execute it accordingly, displaying the results of "=IF($H54=...", or whateverelse you have designated to use as a named formula.
If it's too late for yours, I hope this helps someone else who may face a similar problem.
While I think I know what you're trying to say. Why don't you just use an IF formula to evaluate everything instead of selecting a drop down for every row manually. You already had it partially solved using IF. Just need to add the criteria for a "Done" and an "NA"
=if(A1="date","Done",if(A1<"date","NA",if(something else until you have all your catergories))
Just going to piggyback off of Mark's response.
If you really needed your named formula to be the first selection in the list, you can setup your list with a leading comma like so:
,=UniqueName,NA,Done
That worked out for my use, and there was no null item listed in the Data Validation drop down. Hope that helps!