Highlight row with highest cell value within dynamic range - if-statement

I want to highlight the cells in a Google Spreadsheet with the highest values based on a dynamic range.
I've got two columns: column K and column L. Column K contains sums of data, column L contains either 'Yes', 'No' or 'Maybe'.
I want to use conditional formatting to highlight the rows with the highest value in column K AND which contain 'Yes' in column L (so, the highest value in column K is only calculated from the rows that contain 'yes' in column L as well). It is possible that there's multiple highest values that have 'Yes'. So while the absolute highest value in the whole of column K can be found on (for example) K100, and the second-highest is found on K59, if L100 doesn't include 'Yes' on column L but L59 does, row 59 will be highlighted.
I've got this code for highlighting whenever L is equal to 'Yes':
=$L:$L = "Yes"
And this code for highlighting the highest value in column K:
=$K5=MAX($K$5:$K$999)
But I have to combine them somehow.
I think that some kind of IF- or AND-statement will be the solution, but I don't know how to dynamically call on the range I need. The position of the Yes'es change based on other values and are not necessarily below each other. For instance:
=IF($L:$L="Yes";MAX($K1;$K3;$K4;$K9))
Where '$K1;$K3;$K4;$K9' represents the dynamic range.

try like this for range A5:Z:
=($L5="Yes")*($K5=MAX($K$5:$K))

Related

Power BI: shifting a column one row above

I have a case that I want find the duration for each "state_id", by subtracting its change_time from the time just below it.
So I want to generate a new column that duplicates the column "change_time" and shifting all values one row up, so the change_time #2(in red) would come next to change_time #3(in red).
Is there a way to shift that column one row up?
After a lot of thinking and researching. I have solved it with the following steps:
Sort you columns of interest from A-Z (in my case sort: ticket_id, then history_type_id, then stat_id)
make a first new index column starting from 0 using "Index column from 0".
make a second new index column starting from 1 using "Index column from 1".
merge your query with itself using "merge query" based in the two new indices.
expand the merged query for the date column only.
Now you will have a new date column, duplicated from the old one with a shift of one row.
2)

Input text in one column (a) if the value in another column (b) is found in another column (c)

I have two lists of people - they will not be sorted in the same order. The second list is in a different sheet. If the person listed in column A shows up in Column A in the second sheet, I want column F to display "Y." If not, I want column F to display "N."
This formula: =ArrayFormula(vlookup(A2:A,Attendees!A2:A,1,0)) almost gets me there, but I can't figure out how to get it to return Y/N instead of the name of the Attendee or not.
Any ideas?
try:
=ARRAYFORMULA(IF(IFNA(VLOOKUP(A2:A, Attendees!A2:A, 1, 0))="", "No", "Yes"))

Vlookup or better alternative for retrieving column D into Column N if C contains

CONTEXT
Sheet 1, Column L has a combination of numbers and letters (internal reference) - e.g. 32948/78TPL
Sheet 2, Column C CONTAINS Column L (sheet1) - e.g. Payment proof for 32948/78TPL sent by Tom.
Sheet 2, Column D contains time/date
WHAT I WOULD LIKE TO ACHIEVE
Retrive on Sheet 1 Column N, the value of Column D where Column C (both from Sheet2) contains the value of Column L (sheet1)
Basically retrieve the time/date column from Sheet 2 for the correct row on Sheet1
WHAT I'VE TRIED
VLOOKUP("*"&$L7&"*",(Sheet12!C2:F),{3},false),"")
WHAT HAPPENS
It does return the correct value but works only for that row
If I change to VLOOKUP("*"&$L7:$L&"*",(Sheet12!C2:F),{3},false),"") it returns some strange values like "43984.76019" where the time/date cell should return values like "6/2/2020 18:14:40". So the range can't be assigned like that and probably the problem is trying to use a range with wildcards which I think it's not possible
If I manually stretch the formula (1st version) it returns wrong values for rows where Column L is empty
Is VLOOKUP the way to go?
Can someone please point me to a better direction?
Thanks in advance.
try:
=ARRAYFORMULA(IFNA(VLOOKUP(L2:L, {REGEXEXTRACT(Sheet2!C2:C,
TEXTJOIN("|", 1, L2:L)), Sheet2!D2:D}, 2, 0)))

Can't count cells populated by a RegExMatch function

I am attempting to count the sum of a column populated by a RegExMatch function but using a COUNT function, eg =COUNT(F2:F100).
The function that populates a cell with '1' is:
=IF(RegExMatch($E2,"SKU123"),"1","")
I can see '1' appear many times in the column but when I attempt to sum the column I get a zero answer.
Any suggestions for how I perform a better RegExMatch (or alternative) or way to sum the column?
Change your formula from
=IF(RegExMatch($E2,"SKU123"),"1","")
to
=IF(RegExMatch($E2,"SKU123"),1,"")
and will work.
COUNT returns the number of numeric values in a dataset, and you were filling with strings. SO in your version it will always return 0.

Highlight row when two cells match

I have a sheet where on column "F" I enter the number of items purchased and on column "I" the number of items sold.The actual data starts at row 4. I want to change the color of the rows when the number of sold items matches the number of purchased items. I was able to do that with conditional formatting and the formula : =$F4=$I4 . This works ok but my problem now is that all the empty rows change color since there is no data in either of the columns and so they match. I tried filling out the sold items column with 0 but it didn't work. Any ideas ? Thanks.
I used this and it works :
=AND($F4>0,($I4+$J4+$K4)=$F4)
This way the row will get highlighted when the sum of I+J+K = F but only if there is a value bigger than 0 in F.