change output cell based on different cell's value - google-sheets

I'm creating a spreadsheet about my paylog.
I want to have a sum where it tells me how much still needs to be payed out based on if the box next to it is y or n (y=payed out, n=payed out, which means go into the sum box)
After viewing that, this should be the result.

Based on that info then I would change up a few different things to avoid the circular dependency. For your total formula, I would use as SUMIF: =SUMIF(B:B,"n",C:C) That will only count the values in column c if column b is equal to "n". Next I would use conditional formatting to change the font color to white for all values in column c when column b is equal to "y". I've provided a demo sheet so you can view the results. This will allow you to have values in column c which will remove the circular dependency issue. Feel free to make a copy to be able to view the editable version.
Demo Sheet here
I'm sure there are many other ways to accomplish your goal but without more info...that is a direction I would go.

Related

I'm looking for a Google Sheet array function to add specific increments in each row

Here's how it looks.
Hi. I'll try to be as specific as possible about this :)
I'm making a Google Sheet page similarly to a game character progression, that will automatically fill up based on data from other sheets: specifically, these "EXP" bars fill up with values based on the hidden cell A5.
For instance, the cells from D5 to BA5 represent LV1.
As the function shows, every time the value in A5 reaches an even number (for LV1, it's all even numbers from 2 to 100), one of the slots will fill up with a number, that with conditional formatting, will change the color of the cell and make it look like an actual exp bar filling up.
I'm using the function =COUNTIF(A5,">=2") and manually changing it to ">=4", ">=6" etc until ">=100" for the first bar. The second bar will have its 50 cells with all even numbers from ">=102" to ">=200".
So, to get to the question: is there an array formula that facilitates the process of filling a great amount of these bars with functions, without changing them all manually? Even automating *some *of this process would be great. Besides it being tedious, it leaves a lot of room for human error.
Thank you in advance to whoever's got an answer.
P
I haven't tried much as at the moment I am very confused by the vast amount of options array formulas provide. I have 48h of experience in the matter.
I suggest you to use the values of columns and rows here as helpers to do calculations. If you know that every column adds 2 and every row adds 100 you can set a formula like this for the whole range (select the whole range and add just one rule of conditional formatting):
=$A$5>((Column(D5)-3)*2+(Row(D5)-5)*100))
You use $symbol to make A5 steady and D5 value will "move" to each cell for conditional formatting, so you don't have to make an ARRAYFORMULA for this

How to Transpose Rows to Columns Towards Left Columns? In Google Sheet

SECOND IMAGE CLICK NUMBER 1 I Want To Transpose Row Value Range A2:A50 To Column CZ2 To BC2. Formula Should Be Given IN CZ2. AND VALUE SHOULD GET IN REVERSE OR LEFT COLUMNS.[First IMAGE Click Number 2] 2. If I Give Transpose (AO2:AO50) In CZ2 it Will go range from CZ2 To EW2. I Want Transpose in Reverse Columns. If I Increase Row Value AO2:AO60 It Should Flow Towards Left From CZ2 To AS2. I Mean Transpose Should work towards Left Side Columns. Its Ok with any other formula If Not Transpose. Hope My Question is Understandable. Someone Help Me Out. Thank You In Advance.
It's not clear why you would want to do this. However, the end goal can be achieved by placing the following formula in cell B2 (not CZ2):
=ArrayFormula(IFERROR(VLOOKUP(COLUMNS(B1:1)-COLUMN(B1:1)+ROW(A2)+1,{ROW(A2:A),A2:A},2,FALSE)))
Try it and you'll see what I mean.
The formula is written to be flexible. So if you add or subtract data from A2:A, the value in A2 will always be in Row 2 of the last column to the right in the sheet; and all other values will work backward from there.
If you always want to start to backward progression in Column CZ and Column CZ is not (or may not always be) your rightmost column, you can use this version:
=ArrayFormula(IFERROR(VLOOKUP(COLUMN(CZ1)-COLUMN(B1:CZ1)+ROW(A2)+1,{ROW(A2:A),A2:A},2,FALSE)))
Just understand that, if you don't have columns at least through Column CZ, this formula will fail to work as expected.
I recommend using the first formula I supplied above, since it will always work, no matter how many columns there are, filling backward as far as to the formula column (B2) as needed.
Understand also that if you have more than 103 rows of data in A2:A, that would be more than could fit between B2 and CZ2; so only the first 103 would be displayed.
ADDENDUM (after reading first two comments below):
The principle is the same if you want to run results from "CZ to BC"; only in this case, you want to limit the results to no more than 50.
Place the following formula in BC2:
=ArrayFormula(IFERROR(VLOOKUP(SEQUENCE(1,50,ROW(A2)+50-1,-1),{ROW(A2:A),A2:A},2,FALSE)))
To reiterate, you cannot run formulas that will fill or columns backward. (Even if the sheet is set to right-to-left font with Column A appearing at the far right, the formula is still filling A-Z according to that setup.) However, if you know that you want a 50-column range reserved and you want the answers to go backward, this can still be achieved by placing the formula in the first of the 50 columns rather than the last, as I have proposed above.

Google Sheets - Multiply field by field three to the left

My title might not be very specific, so I'm going to try to explain a little better.
The sheet is divided into a name(Column A), containing a certain number of values(Column B), that get added together to a total in Column C. Furthermore, Column D, E and F contains the values I want the Total in Column C multiplied by. These first columns A to F I just fill in manually, but I would like a function to calculate the Columns I've called x, y and z total (G, H and I).
I see a pattern in this, I just can't figure out the syntax to get Sheets to see it aswell.
The pattern I'm invisioning is for each row, I want column G, H and I to take the value 3 fields to their left, and multiply it by Column C, at their row number.
Is this somehow achievable? I tried finding a solution online but I guess I don't know how to word myself.
Here's a picture to maybe make everything a little clearer
This would save me alot of time, given that I have over a hundred different rows this calculation needs to be performed on...
If something is not clear, please feel free to write a comment. I'll be following this thread quite liberally.
Thanks in advance!
You can have this formula on the first xTotal:
cell G2: =ARRAYFORMULA(if(len(C2:C),C2:C*D2:D,))
cell G2: =ARRAYFORMULA(if(len(C2:C),C2:C*E2:E,))
cell G2: =ARRAYFORMULA(if(len(C2:C),C2:C*F2:F,))
I created a sheet with the same results you had before, but this time you don't need vertical columns, just say in the # of Values column how many numbers you should have below. You just need to input the values with the grey columns.
Note: This is assuming you will always have growing vertical numbers like 1,2,3,4,5. In the new sheet you just need to set 5 in the column and it will calculate the result.
Please make a copy of this sheet and edit as you wish.
Sheet
You can use a single, simpler formula for this in cell G2
=ARRAYFORMULA(if(C2:C="",,C2:C*{D2:D,E2:E,F2:F}))

Counting the Number of Empty Cells between Non-Empty Cells in Google Sheets

I'm trying to count the number of empty cells that exist in a column between each non-empty cell but haven't been able to work out how.
Using this, I'm also trying to find the largest "empty distances" and locate the cell in the center of these distances.
The sheet I'm working with lists a set of marker colors and denotes the ones that are owned out of the full set of colors. I'm trying to find the largest ranges of missing colors and then find the colors in the middle of those ranges in order to find a handful of markers that would best help to fill out the spectrum.
Columns 1-6 are information- Column 7 marks whether the color is owned:
I may have an answer that helps you.
I could only get it to work using a helper column, but someone may know how to eliminate that requirement.
The helper column creates an array, basically listing the row numbers of the rows that have an "x" in your column B.
The main formula then measures the gap between each of these listed row numbers. It also checks the gap before the first "x", and after the last "x". Note that I have the data starting on row 2, which complicates the formula, but makes the sample sheet clearer - this can easily be changed to row 1 if you prefer.
={F2-1;
query(ArrayFormula(if(isnumber(F3:F),F3:F-F2:F-1,"")),
"select Col1 where Col1 > 0",0);
counta(A2:A)-indirect("F"&COUNTA(F$2:F))}
See a sample sheet here:
https://docs.google.com/spreadsheets/d/19QUFGRqTT6BqOsBrEBpTIxQCeNdRa5mzXhxQpCZ8sV4/edit?usp=sharing
Then I used a second formula to calculate the max gap between "x"s, (or before the first or after the last x).
Note that calculating the midpoint of the gaps, and doing a lookup of the corresponding mid-point colour, is something that can be added to this answer, if you share a sample copy of your sheet and share it for editing.
Let me know if this helps. I'll add more explanation to describe what the formula is doing tomorrow.
And I'll provide a second tab with the formulas adjusted to work with data beginning on row 1.
You can also get the lengths of the gaps using Frequency:
=ArrayFormula(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),if((B1:B20="X")*(A1:A20<>""),row(B1:B20))))
but finding the centres of the gaps and allowing for equal-sized gaps is more difficult.
This should find the position of the "X" at the end of the longest gap:
=ArrayFormula(
sum(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))*(sequence(countif(B1:B20,"X")+1,1)<=
match(max(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))),frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20))),0)))+
countif(sequence(countif(B1:B20,"X")+1,1),"<="&
match(max(frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20)))),frequency(if((B1:B20<>"X")*(A1:A20<>""),row(B1:B20)),
if((B1:B20="X")*(A1:A20<>""),row(B1:B20))),0))
)
and then it should just be a case of working backwards from there to the centre of the longest gap. However the formula needs further refinement to deal with the cases
(1) Where the longest gap is after the last "X"
(2) Where there is a tie for the longest gap
(3) Where there is a need to list the longest, second longest, third longest gap etc.

How to use arrayformula to dynamically join strings in google spreadsheet?

I use Arrayformula() to make my reports dynamic and easier to edit. For example, if I have a Column A with a list o number o blue balls in a set and a Column B with a list red balls in a set, on the cell C1 I can write =ArrayFormula(add(A1:A,B1:B)) and in the Column C will have the total of balls in each set. It would be exactly the same as writing =A1+B1 in cell C1 and dragging the formula down to the last row. Arrayformula() has some benefits, because it will work if some adds or removes rows from the sheet and also it makes the reports way more organized and easier to edit.
Since I´ve discovered arrayformula(), my life has changed, because of the fact that googleSheets expands the formula to other cells. It does not work every time, but the idea of expanding to other cells seems to be possible some way or another, here is a good example of a problem that was not resolved by arrayformula(), but has the same idea.
Keeping that idea in mind, imagine that on Column A there is a list of First Names and on Column B there is a list of Last names. On Column C I want to join this two string using a simples space. The way to do that would be in the cell C1 write =join(" ",A1,B1) and then drag down this formula. This method method however is prone to error since people can add and remove rows, deleting my formula. I want to use a formula that I can write in one single cell and it expands to other cells. I´ve tried =arrayformula(join(" ",A1:A,B1:B)), but it does not work.
Is that a way to do that using =arrayformula() or other native function?
I know I could write a script or custom formula to do that, but this is not my goal here.
I think this formula should work:
=arrayformula(A1:A&" "&B1:B)
In case you want to use a delimiter, you can do the following to have a clean result even though, A or B is not present in some cases:
ARRAYFORMULA(ifna(ifs(isblank(A1:A),,ISBLANK(B1:B),A1:A),A1:A&" - "&B1:B))

Resources