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.
Related
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))
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))}
Need some help. I'm currently making a Google Sheets, and I need some conditional formating. I need a row to be formatted with the condition on one of her cells.
For example, I need to formate A2:I2 with the formula =$H$2="No".
This was the easy part. I can do that.
The part that I fail is :
I have like 30 or 40 rows to formate like that, with the condition on the cell of the row. (H15 for A15:I15, H21 for A21:I21...). I tried to select the first row, copy it, and special past the formatting to another row, but Google makes some weird shit. It creates a new rule, but keep the previous cells range and add the currently selected. And the formula stays on the $H$2. I know it's because I put some $ in the name of the cell, but if I don't, it will not formating the entire row. Juste the first cell.
My question is :
How can I properly copy/paste the conditional formatting of the first row to the others one, with the condition correctly on the cell of each row, and keeping the formatting on the entire row?
The meaning of the $ sign is the following:
$H$2: it will lock that cell only,
H$2: it will lock that column,
$H2: it will lock that row (I think this is the one you are looking for),
So you can set the range to be: A2:I
And the formula to be: =$H2="No"
I have made a simple formula, based on cells in the same row, to indicate to the user that they have entered enough information - and it works as needed .
=IF(AND(ISTEXT(B20),ISNUMBER(C20),ISNUMBER(E20),ISTEXT(F20)),"Ok",IF(AND(ISBLANK(B20),ISBLANK(C20),ISBLANK(D20),ISBLANK(E20),ISBLANK(F20)),"","MORE INFO"))
However, when I click the built in "add more rows" button at the bottom of the sheet the formula is not present in the new cell - but any dropdown menu or validation I've used in the cells not containing the formula are present in the respective added cells of the new row. Any Ideas why just the formula is missing ? Thanks.
Thanks to GimelG at Google Docs Forum..........
When you add additional rows, Sheets assumes you want to continue the same dataset and, therefore, applies the existing formatting as well as Data Validation. It does not, however, copy formulas automatically as that would be adding actual new data to your sheet.
You can use an ArrayFormula version of your formula to populate the entire column, which it would continue to do as you'll add more rows of data. Assuming your data starts at row 2 (below the header), try this:
=arrayformula(if(istext(B2:B)*n(C2:C)*n(E2:E)*istext(F2:F),"Ok",if(len(B2:B)+len(C2:C)+len(D2:D)+len(E2:E)+len(F2:F),"MORE INFO",)))
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.