I need to compare the superior row with the inferior one so I can create empty ones orwith the content depending on that comparison - comparison

I need to creat the colums "codigo", "color", "talle", "lista","precio" in the right using the values of the some ones of the left. What I want to do is that when the value of "codigo" of the inferior row is the same as the superior row and the value of "precio" of the inferior row is the some as the superior row, all the inferior row must be empty, however, if "precio" changes, then the inferior row must show its value of, and only, "codigo", "talle" and "precio" . If the value of "codigo" of the inferior row compared with the superior row is different, then the inferior row must have the value of "codigo" and "precio", and then repete the procedure all over again till the end of the rows.
columns I refer in the text

Related

How do I get a value from another sheet, a specific row and column based on dropdown value with a range?

I've created a LANGUAGE sheet with each word in a row and its translation in the next row. I can now add new languages as needed by adding columns with translations.
I've then set up a language dropdown menu containing all languages (=LANGUAGES!$1:$1) automatically.
Now, HOW do I put the value in a cell based on the dropdown?
Say I have the word 'Faktura' in the first column (second row) under the language 'DA' (first row) and the word 'Invoice' in the next column under 'EN'.
Put this word in the cell if the Dropdown has DA selected otherwise put this word in the cell if the Dropdown has EN selected.
Hope this makes sense. I'm pretty sure it's simple, but I can't wrap my head around how to make Google Sheet do what I want it to.
I've been wildly guessing with things like: =LANGUAGES!$1:1???????=F3<-DataValidationField) ... simply cannot figure out or even guess what to write in the formular. Mind bendingly counter intuitive.
Use: =HLOOKUP(F3;LANGUAGES!A:B;2;false)
Where F3 is the cell for the dropdown (the range) A:B represents the col range and 2 the row to get the word from ...

Conditional formatting at row level

I have 2000 rows of cost price data. In each row, I would like to apply a color scale to quickly highlight cost prices (from low to high). However, I would like the color scale comparison logic each time to be applied within a specific row. So row 12 data should not be compared to row 13 data for instance. How can I do this without creating 2000 rules stipulating each row?
I have done it for the first row as below:
D3:BL3
However, when I try $D3:$BL2000 and hit "Done" the $ signs just disappear meaning the formatting logic isn't applied at row level but all rows (so e.g. row 4 is compared to e.g. row 100).
You can't have a conditional formatting with scale color row by row with Google Sheets option. You can simulate it with the help of MIN, MAX and QUARTILE. Here you have an example:
=(D1=MAX($D1:$Z1))*(D1<>"")
=(D1>QUARTILE($D1:$Z1,3))*(D1<>"")
=(D1>QUARTILE($D1:$Z1,2))*(D1<>"")
=(D1>QUARTILE($D1:$Z1,1))*(D1<>"")
=(D1>MIN($D1:$Z1))*(D1<>"")
=(D1=MIN($D1:$Z1))*(D1<>"")
PS: remember to sort accordingly the rules. In the top the highest values (in green in my example) and in the bottom the lowest values
PPS: you could do something similar with the help of RANK or LARGE/SMALL, depending on your data

Counting correlated checkboxes

If I have a row of checkboxes which indicate especially important columns in a sheet, how do I count for each row how many of the relevant checkboxes are ticked.
For example:
If the top row tells me that I am especially interested in the answers in columns 3, 6, 9, 13 & 15, I would like for each row to do a calculation that tell me how many of the corresponding checkboxes in that row are NOT selected.
In this example, running the calculation on row two should produce a result of 2, as the checkboxes in this row are not selected in the case of the 'important' columns 6 and 13.
The same calculation performed on row three should produce the result 0, as all of the 'important' columns have their checkboxes selected in row 3.
I'm looking for an answer that doesn't require a lot of brute force ANDing or ORing, since the columns are likely to change fairly often. A good answer would have something like the form:
"For this row, how many of the checkboxes between in columns 1 to 19 are unchecked where the corresponding checkbox in row 1 is checked"
(If it helps, the spreadsheet is for comparing product features between different offerings. there's a product on every row, while each column represents a feature. I want to be able to select the 'must have' features in row one, and get a number for each product that tells me how many of the key features it is missing. The contract goes to the reasonably-priced product that returns 0).
tia
Since we are comparing 1st row vs another row, a way to solve this is by using ARRAYFORMULA and subtracting 1st row with the current row.
Since ticked checkboxes are TRUE, it has a numerical value of 1. And if we subtract 1st row and the current row, (the unticked current row is 0) then it will result into 1.
With this in mind, we just need to count how many are there that results to 1.
Final Formula:
=COUNTIF(ARRAYFORMULA(C$1:U$1 - C2:U2), "=1")
Output:
Note:
Since row 3's 3rd column is not ticked, result should be 1 instead of 0 which you mentioned mistakenly in your post above.

How to use ARRAYFORMULA with OFFSET to previous row without getting circular reference error

Example sheet: https://docs.google.com/spreadsheets/d/14ma-y3esh1S_EkzHpFBvLb0GzDZZiDsSVXFktH3Rr_E/edit?usp=sharing
In column B of ItemData sheet, I have achieved the result I want by copying the formula into every cell in the column, but I want to solve this using ArrayFormula instead.
In column C I have achieved the same result using ArrayFormula. However, for addition, column C is referring to cells in column B, while column B is referring to cells in column B. I.e. every cell in column B is adding 1 to the cell on the row above.
If I select the C3 formula text and paste it into the cell edit field for cell B3 (to not screw up cell references during copy - I know I could make them static references, but this is not my problem), the cell gets an error value of
#REF!
Error
Circular dependency detected. To resolve with iterative calculation, see File > Spreadsheet Settings.
Do note that the additions that need to be done are the same in both cases: Add 1 to the value of the cell on the previous row, so there is no circular reference involved. There is a starting value provided in B2, and cells in B3 and downwards should use the data from the B cell in the previous row.
Also, note that I did try File->Spreadsheet settings and enabling circular reference computation with max 25 items, but this only fills in the first two cells (B3 and B4).
How can I solve this problem? I would prefer having something like ArrayFormula, where the formula only exists in a single cell. But copy-pasting would be acceptable as long as any new rows, inserted in between or added at the bottom, would get the same formula added in column B.
Will matching items always be consecutive? It seems that way since you're comparing each Item cell to the cell above it right in your formula logic. That breaks an [unwritten?] rule of spreadsheet normalization; values' addresses themselves generally should not be treated as data.
IF you're committed to it though, have you considered explicitly using location as a data source? Example:
=ARRAYFORMULA(IFS(
NOT(LEN(A3:A40)),,
ROW(A3:A40)-3-MATCH(A3:A40,A$3:A$40,0)<=VLOOKUP(VLOOKUP(A3:A40,Items!$A$2:$D,2,false),DataPerColor!$A$2:$B,2,false),ROW(A3:A40)-3-MATCH(A3:A40,A$3:A$40,0),
true,
))
Just like your formulas, all that does in English is:
for each row,
if there's no Item, don't output any ItemData,
if the number that belongs in this cell¹ is less than or equal to the lookup, print it,
otherwise, don't output any ItemData
But then what is ¹ "the number that belongs in this cell" and how can we calculate it without using column B? I abuse locations of things to get it. Looking down your row B, each number that appears is just:
this row's number,  minus  
the row where items start [always 3],  minus  
the row number [in just the Item rows] of the first row containing this row's Item
Using the second-to-last ItemC as an example: the first ItemC is the 16th item listing, and the one we're looking up… the "second-to-last ItemC" is in row 21 of the sheet. 21-3-16 = 2 …the number you wanted.
If you can stomach that, it's a single formula and does work according to your specifications.

Working with hierarchical data in Google Sheets

If I have hierarchical data in a Google Sheet as in columns A and B in the example below, how can I write a formula that will fill the corresponding cells in column C with the product of the "parent" value in A1, and the "child" values in column B. That is, The formula in C8 for example, will search upward in column A until it finds the value 5 in A6, then multiplies it by 8, the value in B8.
Obviously I'm trying to avoid having to put the "parent" value in every row in column A.
After a fiddling around and jogging my memory on ArrayFormulas I figured out how to get the result I wanted. Here's the formula I'm using:
=ArrayFormula(index($B$2:$B2,MAX(IF(ISNUMBER($B$2:$B2),ROW($B$2:$B2)))-1,1))
(Note: Row 1 contains headings)
Edit: Explanation of how I arrived at this solution:
Ordinarily, IF(ISNUMBER(cell)), and ROW(cell) would return TRUE/FALSE, or a row number respectively. When used in an array formula and a range of cells as input instead, what you get is a list of TRUE/FALSE values, and row numbers evaluated for each cell in the input range. Wrap MAX around that and it will return the position in those two lists where IF(ISNUMBER()) is TRUE and the row number returned by ROW() is the highest, effectively searching from the bottom of the range.
The absolute reference for the first element in the range to be searched (in this case $B$2) keeps the range anchored to the same starting location when dragging the formula into other cells, while the lower bound of the range (in this case $B2) to be searched grows vertically.
Finally, the INDEX takes the input range, row number returned by the above (-1 row because of the header) and column position (1, since there is only one column) in order to return the desired value.
One way you could do this would be to associate each value in column B with a category or key that can be used to lookup the value for A in a separate table. This abstracts it somewhat, so you can change the values for the A column without having to have them in every row, but there's no empty cells.
i.e.
and lookup table:
In column C
= VLOOKUP($A1, <range for category lookup table>, 2, 0) * $B1
(And then this formula can be filled down)
More on VLOOKUP in Google Sheets here
Alternatively I suppose you could use a formula to find the last non-empty row in column A, or something along those lines, but this is more of a hack than a proper way to structure your data. Tables aren't really designed to be used in a hierarchical fashion like what you've shown. But they can easily represent hierarchical data using techniques like what I've suggested.

Resources