I have a spreadsheet for a game that I play (EvE Online), and this is the table I use:
I'd like to know how can I make conditional formatting to highlight the MAX value comparing columns I (corp total) and column M (market total) for each line, my goal is to have these values highlighted as an example:
=QUERY(TRANSPOSE(QUERY(TRANSPOSE($I1:M),"select
"®EXREPLACE(JOIN(,ARRAYFORMULA(IF(LEN(I1:I),"max(Col"&ROW(I1:I)-
ROW(I1)+1&"),",""))),".\z",""))),"select Col2")
Related
In Excel/Google Sheets I have found how to sum every N columns on websites such as https://exceljet.net/formula/fixed-value-every-n-columns, but the problem is, from what I can see is that it starts at N column each time. I need something that starts from column 1 and then counts every N columns. like the following:
I need to do this with a formula and not a script.
With Google-Sheets, try:
Formula in M2:
=SUM(QUERY(TRANSPOSE(A2:J2),"Skipping "&L2))
Or, a single dynamic array formula (without dragging):
=INDEX(MMULT(A2:J4*(MOD(COLUMN(A2:J4),L2:L4)=1),SEQUENCE(10,1,1,0)))
Or, more dynamic:
=INDEX(MMULT(A2:J4*(MOD(COLUMN(A2:J4),L2:L4)=1),SEQUENCE(COLUMNS(A2:J4),1,1,0)))
Note: The latter would also work in Excel with slight modifications.
Google sheets formula:
=SUM(FILTER(A2:J2, MOD(A2:J2, L2)=1))
then drag to other cells
or use this array version:
Array version:
=INDEX(TRANSPOSE(MMULT(A2:J4,TRANSPOSE(COLUMN(A2:J4)^0 *
N(MOD(COLUMN(A2:J4), L2:L4)=1)))), ,1)
If you want the cells that were added to be automatically highlighted.
Conditional formatting used on A2:J:
=MOD(COLUMN(), $L2)=1
In M2:
=SUMPRODUCT(A2:J2,N(MOD(SEQUENCE(,COLUMNS(A2:J2),0),L2)=0))
and copied down.
Try this formula on column M:
=SUM((sumif(ArrayFormula(mod((COLUMN(B2:J2)-COLUMN(B2)+1),L2)),0,B2:J2))+A2)
Here's the result on Column M.
Just to break down the code sumif(ArrayFormula(mod((COLUMN(B2:J2)-COLUMN(B2)+1),L2)),0,B2:J2) does the actual calculation with the number of intervals set on Column L but take note that I started at the 2nd column so the range here does not include the first column. The result from this is at the Column O highlighted red as you can see in the screenshot.
At the Column M is the actual solution where I only added the first column by using SUM on top of the previous formula.
I hope my explanation is clear.
Just copy/drag the formula down to each row and it should work.
Reference: How to Sum Every Nth Row or Column in Google Sheets Using SUMIF
I need an array formula only in column Date_2 with results like on screenshot and that will
insert last day of month depending on Date_0 (if bunch of Color&Fruit&Meal doesn't repeat in table)
insert first minimum date of column Date_1 (if bunch of Color&Fruit&Meal repeats first time) - 1
insert second minimum date of column Date_1 (if bunch of Color&Fruit&Meal repeats second time) - 1
and so on...
Is is possible to solve it with array formula?
I've tried but I can't..
=ArrayFormula(IF(A2:A="","",IF(COUNTIF(B2:B&C2:C&D2:D,B2:B&C2:C&D2:D)>1,INDEX(FILTER(B2:E,E2:E<>""),1,4),EOMONTH(A2:A,0))))
Google Sheets
I'm not quite sure what you need for Date_1 but try this arrayformula in cell F2 for Date_2:
=ARRAYFORMULA({"Date_2";if(IF(B2:B&""&C2:C&""&D2:D<>"",if(A2:A<>"",COUNTIFS(B2:B&"|"&C2:C&"|"&D2:D,B2:B&"|"&C2:C&"|"&D2:D,ROW(A2:A),"<="&ROW(A2:A)),),)=1,eomonth(A2:A,0),)})
I've added a duplicate sheet ("Erik Help") with the following formula in F1:
=ArrayFormula({"Date_2";IF(A2:A="",,IFERROR(VLOOKUP(B2:B&C2:C&D2:D&TEXT(COUNTIFS(B2:B&C2:C&D2:D,B2:B&C2:C&D2:D,ROW(A2:A),"<="&ROW(A2:A))+1,"000"),{B2:B&C2:C&D2:D&TEXT(COUNTIFS(B2:B&C2:C&D2:D,B2:B&C2:C&D2:D,ROW(A2:A),"<="&ROW(A2:A)),"000"),E2:E},2,FALSE)-1,EOMONTH(A2:A,0)))})
This formula creates the header (which you can change within the formula) and all results for Column F.
To lookup the "next instance of the group if there is one," I just wrote the formula to VLOOKUP that grouping plus a text rendering of the COUNTIFS-as-of-that-row-plus-1 for that grouping within a virtual array of each-grouping-plus-unique-count-thus-far in one column and the E2:E data in the next column. For instance, for Row 2, the formula VLOOKUPs redapplepie002
(002 being the text rendition of 001, which is the count of redapplepie as of row 2).
While searching for a function to use, I found the below formula to adapt from.
=TRANSPOSE(ArrayFormula(TRIM(SPLIT(QUERY(A1:A30&"|"&rept("|",1),,2^99),"|",1,0))))
What has worked so far is the use of the below formula but
I can't seem to change it to more than 1 separator column.
={(ArrayFormula(TRIM(SPLIT(QUERY(UNIQUE(A2:A)&"|"&rept("|",1),,3^99),"|",1,0))))}
Also, is it possible to add headers to the currently empty separator columns in the sequence of example: "qty","expiry","available qty" before the next column and repeat again "qty","expiry","available qty"
Test spreadsheet in at cell I1 (Join function doesn't work as there's a limit):
https://docs.google.com/spreadsheets/d/1w64R9QR_pAvdGy7IZLsHFvhIYIGL7lqsl_vFXrqsQMc/edit#gid=799170483
Please use the following formula and adjust ranges to your needs:
={(ArrayFormula(TRIM(SPLIT(QUERY(UNIQUE(A2:A)&"|qty|expiry|available qty"&rept("|",1),,2^99),"|",1,0))))}
Functions used:
ArrayFormula
TRIM
SPLIT
QUERY
UNIQUE
Using Google Sheets, I have a reference sheet with names along the Header and 3 values below each.
On the primary sheet, I want to have a name input in cell B8 and a formula in C12 to take that name and lookup in sheet 'Range' for the 3 values but return the highest value of the 3.
Here is the shared sheet: HighValueTest google sheet
Once I have that value (between 1 and 5) I want to highlight a column of cells representing the count of that value.
Any help greatly appreciated!
Here's a formula to copy it down for that max values of your heroes:
=MAX(INDEX(Range!$B$2:$4, 0, MATCH(B8, Range!$B$1:$1, 0)))
And here is the formula for conditional formatting for that indicator rows (apply to the range B2:B6):
=MAX($C$21:$C$23) >= (5 - ROW() + ROW($B$2))
$C$21:$C$23 here is just the range where we've put our max values before.
I'm having a problem getting Google Sheets to color the top 10 values in multiple columns.
I have columns that contain the following stock information:
Account,Ticker,Symbol,YTD,1 Yr,5 Yr,10 Yr,Risk,Return,Star Rating
Example:
T. Rowe Price U.S. Large-Cap Core Fund,TRULX,2.2,3.93,12.3,12.67,2,5,5
I would like to color the top 10 values for the 1 Yr, 5 Yr, 10 Yr columns.
I thought the function large(L:L,10) would do the job but it seems that the function needs to be sorted by the field that its coloring and it doesn't seem to work if the values in the column are formulas. All the data in these fields but the ticker are formulas.
Assume that data column is column A.
Here's step by step solution:
select your range, like: A2:A500
go menu Format → Conditional formatting...
Choose 'Format cells if...' = Custom formula is
Paste this formula: =$A2>=large($A$2:$A,10)
To check if the formula works right, you may use this formula, paste it into empty column:
=QUERY(sort(A2:A,1,0),"limit 10")
This formula will give you the list of top 10 values from column A. Change A to your column.