Android Compose Constraint Layout Issue - android-jetpack-compose

I have a Compable function that is composed of 1 column that contains 11 rows. Each row contains a Text and a Button. In the first row I can position each object. I copy the code to the second row (also changing each objects "name") and get errors:
CreateRefs -can't be called in this context
constraintAs (both) - can't be called in this context.
I have a sense that a Row() is not considered a parent.
What is the proper approach considering my a column with multable rows?

It's my error, I failed to wrap the second rows contents with a
ConstraintLayout(...){}
Now I get no errors, but the second row overlays the first row
I'm going to mark this as closed.
Thanks for your attetio

Related

Change cell value based on checkbox in Google sheets

I'm using Google sheet to manage my budget (see sample below) where I add each of my expenses as a single entry (yes, sounds like a lot of work). I sometimes split the expense with my roommate but then I have to add the value and divide by 2 everytime.
I was thinking if I could use a checkbox next to the value that will automatically divide the expense number by 2 when I check it. Is this possible?
I'm open to simple suggestions other than the checkbox to automatically update the value. Thank you.
Using simple IF formula you can just check if the checkbox is true, if it is then it will divide the current value on column C by 2. Otherwise it will remain blank.
Formula:
=IF(D1,C1/2,"")
Drag down to other cells.
Result:
Suggestion, Alternate solution:
If you'd like you can make a table with a column for your roommate, instead of editing the actual column so you can see both values. And use this formula:
=if(NOT(D2=""),E2/2,E2)
You have a column for per head contribution/split. If the cell on roommate is blank then it will stay as the total value, if roommate has an additional then it will be added to total and split it by 2.
Or using arrayformula:
=arrayformula(if(NOT(D2:D=""),E2:E/2,E2:E))
Works the same as above you just have to fill the enter the formula in the first cell no need to drag down and it will automatically expand to rows/cells below just make sure that below cells are empty or it will return an error.
Additional - Using same cell
As you've mentioned in the comments. Here's a way to divide the original value without using another cell to store it. (Not recommended)
Formula:
=VALUE/IF(D1,2,1)
example:
=1000/IF(D1,2,1)
Result:
However, I do not recommend this. It is still best to make use of another cell to store the original value before making calculations to it.
Also, using this formula you have to change the value from the formula and not on the cell otherwise you will replace the actual formula.
You can try array approach-
=ArrayFormula(IF(D1:D,C1:C/2,C1:C))

How can I fix the range of a Google Sheet MATCH function when using a move rows apps script?

I have a Google Sheet with a script to move rows at a set interval. The last row is moved to the top and all consecutive rows move down one, thus creating a loop. This sheet feeds a dynamic gallery of 10 stores which appear in consecutive blocks, managed by left and right arrows. Each block has a button which takes the value of the particular store of the block being viewed.
I want to register the row a store is on when this button is clicked so, in order to identify it, I have placed a MATCH function in a cell of each row with a formula like this: =MATCH("Store 10",B2:B11,0). All's fine up to this point however, when the row moves, the range also shifts. For example, when Store 10 moves from the last row to the first, the above formula changes to =MATCH("Store 10",B3:B11,0). This obviously renders the whole idea useless since Store 10, which now resides in the first row (B2), is not even found, since B2 is not included in the formula's range anymore!
Is there a fix to this or a better way to achieve my goal?
Try this in G1
={"title of column";arrayformula(MATCH(offset(B1,1,,10),offset(B1,1,,10),0))}

How To Detect Which Cells Are Merged In Google Sheets

While trying to remove duplicate phone numbers from a relatively large list I recently combined, Google Sheets presented me with this error message:
There was a problem.
Your selection contains a merged cell. To remove duplicates, all cells must contain the same number of rows and columns.
The formula I used to test and try to expose merged cells within Google sheets was:
=if(columns(A2:F2) = 6, "True", "False")
But this always returned true Because even though the cells may be merged they are still considered individual cells.
I am wondering if there is an easy way to discover and sort out these cells in Google Sheets. Excel used to have a very simple way of doing it but has since removed the functionality.
Any ideas?
if you have such an option you can use Conditional Formatting to check for merged cells like:
=MOD(COLUMN(),2)=0
where you can immediately spot merged cells where the color pattern is interrupted
in the same manner you can use this formula for rows:
=MOD(ROW(),2)=0
or you can play with scripts to find merged cells: https://issuetracker.google.com/issues/36753230
Custom formula
function isMerge(sheetName, a1Notation) {
var range = SpreadsheetApp.getActive().getSheetByName(sheetName).getRange(a1Notation);
var merges = [];
for (var i = 0; i < range.getHeight(); i++)
{
var merge = range.offset(i, 0, 1, 1).isPartOfMerge();
merges.push(merge);
}
return merges;
}
Usage:
Paste the code above to the Editor: menu Tools > Script Editor...
Save Project
Use as usual formula: =isMerge(sheetName, a1Notation)
you can copy and paste the column somewhere, for example creating an extra column next to it.
You can then create a new column. You can run increasing numbers in both and subtract each cell from each other. If the result is not 0, then cells have been merged.
I was facing a similar issue and found a hack - ctrl+shift+down button to select all the data in the column. This automatically became a selection of two columns (the one I want to select plus the one next to it). I then worked from the bottom of the list up, using ctrl+shift+down button to select all data in that column, starting from the bottom 20 entries - with this, only data in that column was select - it didn't automatically include the next row too, which meant that the merged cell was not within these cells.
I repeated this step, going up the rows ~50 rows at a time, until the selection suddenly became two rows instead, when I was actually just selecting a single row's data. This meant that the merged cell was somewhere in the last 50 rows, and I just went down the list within that selection to check for the merged cell.

Count values until the first empty cell

What I looking for is how to count as many values in column, but I want it to stop counting as soon as it hits the first empty cell. I am trying to do it without using app script.
Example:
1
2
312
EMPTY
3123
Should return 3, if I simply use COUNTA(), it will return 4.
Any ideas?
If your "empty" cells are indeed BLANK then you can use the following:
=ArrayFormula(match(TRUE,ISBLANK(A1:A13),0)-1)
(as long as there is always an empty row between the sets of "Years"
the ISBLANK(A1:A13) returns an array result {FALSE,FALSE,FALSE,TRUE,FALSE,...}
the match() returns the POSITION or ROW of the first TRUE in that list : 4
we then take away 1, for the empty row
we have to run the whole thing as an array formula because we need ISBLANK() to work on each cell in turn.
if they contain text "EMPTY" then use:
=ArrayFormula(match(TRUE,if(A1:A13="EMPTY",TRUE,FALSE),0)-1)

Excel: How to auto-populate cell with data using static column with a row dependent on another cell?

I've got an spreadsheet with hundreds of problems listed out that map to a smaller number of solutions. I want to use this data to generate a drop down that selects the problem from a data range, and then next to it, another cell that populates the solution from one row over.
Example:
Column A Column B
Issue 1 Solution 1
Issue 2 Solution 4
Issue 3 Solution 5
Issue 4 Solution 1
Issue 5 Solution 1
Issue 6 Solution 3
Issue 7 Solution 2
If I want to create two cells where the first one is a drop down list (A1:A7), how can I make the second cell populate using a static column (B), but with a dynamic row number based off the first cell. So if someone chooses Issue 6 from the dropdown (A6) the second cell will know to populate Solution 3 (B6)?
Thnaks
To do this, you need two steps:
1) For the first cell where you'll have the dropdown option, click on Data Validation command (under the Data ) In the Settings menu in the dialogue box, click on "list" and set the Source to the Column A cells (without the header). This will make these the options in the drop down menu
2) For the second cell where you'll have the solution automatically change depending on the first cell, you'll need to use the vlookup function. The syntax looks like this: VLOOKUP(lookup_value,table_array,col_index_num,range_lookup)
In this case, the lookup_value will be the first cell, the table array will be your original table (without the headers), the col_index_num will be 2 (which means it will take the answer from the second column), and range_lookup will be FALSE (which means it will look for an exact match)
If you want more information about either one of these steps, here's the official help sections for Excel 2010: Create a drop down link , Vlookup

Resources