How to count the number of items and have this sustainable when I add new items? - google-sheets

I am trying to create a Google Spreadsheet which is able to count the number of items, and also be sustainable when I add new items which won't affect the previous result.
The table at the left is the data, and on the right is the result I am looking for Example:
The two items in RED box are newly added, and the yellow cells show the results expected.
Basically, when there is a item is bigger than ZERO, I want it to be counted. However, I don't want the previous result to change when I drag the function across.
I tried to use the combination of =counta and vlookup, but it is not working properly.

Assuming your red box is around B8:E9 then in H3 copied across and down to suit:
=COUNTIFS(C:C,"<>"&0,$B:$B,$G3)
will give the results you show (other than the highlighting). However, two more days of data and one table may get in the way of the other. You might want to relocate one table above the other so each has room to expand - or move one to another sheet which would then require sheet references to be added to the above formula.
I am not clear what issues you have had with whatever combination of =counta and vlookup you have tried.

Related

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))}

Can I sort values alphanumerically in google sheet and ascend the rows?

I have a google sheet with room names, but they are formatted like (M355) and then the purpose of the room? I know how to sort values alphanumerically but you have to use a written formula. I need the cell next to the rooms to stay with the room number, so I can see the extra data that goes with it. The attached image shows what I mean.
I need the cell next to follow but it doesn't sort right. Has anyone experienced anything like this? I could manually copy and paste the 50 rooms but I ain't feeling that, I also would like it to be able to revert to what it is now too if possible.
Thanks!
You don't need a formula for that. You can just select the first row with your headers (assuming you have such a row), and create a filter.
By doing this, every data in the sorted column cells will bring its full row togheter.

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.

How do I make a sheet filter only show checkmarked rows with multiple variables in G-Sheets

I have a spreadsheet in google sheets that has a lot of checkmarks:
I want to create another checkbox filtering system, either at the top, if possible, or on another tab if not. I've tried putting the filter at the top, but as I'm sure you know, it overwrites the data, so no bueno. I also tried this:
with this code:
=FILTER(Movies!A3:P1000,(IF(F2=0,Movies!F4:F1002=0,Movies!F4:F1002=1)))
Which doesn't seem to be doing what I want either? It's showing a random selection, it seems, rather than only the data with the F column being true.
Ideally, you click the checkmarks of the data you want to see, so, if you click the check under Andrew, Addison and Richie, it would only show the rows that had only Andrew, Richie, and Addison's checkmarks. I am fine with making the checkmarks a 0,1,2 list if needed. (Because checkmarks I think are only binary, unless they have an option somewhere to have a third option that I'm unaware of, and marking some data to not be seen if it doesn't have a checkmark would likely require a third option.)
this is what I've got

Making Google Sheets work like a database

I'm attempting to get Google Sheets to function like a Database, where sheets can "talk" back and forth to one another. Basically, a column on one sheet can auto-populate another column on a different sheet, and vice versa. HOWEVER, the other criterion is that the columns aren't necessarily in the same location on each sheet. In addition, there are many individual cells that merely have to talk back and forth to another, so it can't just be whole columns sharing information back and forth.
It's a little hard to explain, so I've attached the Sheet in question:
https://docs.google.com/spreadsheets/d/12MFlAqZGQsW6wxwSUyNaYJoFD3_Kt5uK7g88Tj_fAms/edit?usp=sharing
Dummy information has been entered into the columns on each sheet to show where the information should be flowing.
There are quite a few picklists in the Sheet, and those would still have to be able to function.
There is another discussion which touches upon this process:
https://productforums.google.com/forum/#!msg/docs/OrObv5ZAmIs/-eNw5g5TGjUJ
The issues with the above solution is that I don't need the other sheets to be hidden, and I have four sheets, most likely seven when the Sheet is completely finished.
It's a complicated Sheet that has to be as user-friendly as possible.
I do this most often with the importrange function. If you need to reorder columns in the second sheet you can specify a single column as you range and place it in any column you need in the new sheet. Using multiple import range formulas in successive columns you can then reorder your data set. This approach is dynamic so any time your original data changes, the associated sheet updates as well.
If you only want to update the second sheet at certain times or on command you can do this with a script and a time trigger or a button object placed somewhere on the first sheet that is associated with the script. The script would read the data from the originating sheet and the write it back to the second sheet in any order you wish.

Resources