Highlighting duplicates over multiple rows using conditional formatting - google-sheets

I'm trying to create a Google spreadsheet to organise a seating plan. I've laid out the page with 11 separated smaller tables in a kind of grid format (for easier reading, as you can see it all without scrolling). Like this:
Table 1 | Table 2 | Table 3 |
Seat | Name | Diet | Seat | Name | Diet | Seat | Name | Diet |
1 | | | 1 | | | 1 | | |
2 | | | 2 | | | 2 | | |
I'm trying to create a conditional format to highlight cells where a name appears more than once.
So I created a conditional format with a custom formula as follows (the range covers the all tables):
COUNTIF($A$1:$O$42, A1)>1;
and I set the range to only the Name cells on the page.
However when I purposely set a duplicate the cells are not highlighted.
I thought that maybe my formula was wrong, so I put into a cell and pointed it at a duplicate cell and it returned TRUE.
So I'm at a loss a how to get it working.

Try this formula applied to range A3:O
=AND(ISTEXT(A3),COUNTIF($A$3:$O$42, A3)>1)
Example sheet is here: https://goo.gl/hChZbt

Related

Google Sheets function Address() results in adding unwanted characters ''! when used in ArrayFormula

If you look at the following table in Column A I have some values that I want to use to make an address reference. I can successfully accomplish this with the formula in Column C copied down into each cell. I would like to use the more dynamic ArrayFormula so that when even I enter a new row it will populate with the correct Address. However, it's injecting ''! before my addresses. I don't know what to do to get rid of it.
I have a workaround in another column in row 3 I enter this. =ARRAYFORMULA(IF(LEN(B3:B), MID(B3:B,4,5),)) however I feel the address should just work without it. Anyone know why it does the unnecessary injection ''!.
link to example Sheet
+------------+---------------------------------------------------------------+-----------------------------+
| | Incorrect but dynamic | Correct if but not dynamic |
+------------+---------------------------------------------------------------+-----------------------------+
| Formula -> | ARRAYFORMULA(IF(LEN(A3:A), ADDRESS(Row(A3:A),A3:A,4,TRUE,),)) | ADDRESS(Row(A3),A3,4,TRUE,) |
| 1 | ''!A3 | A3 |
| 2 | ''!B4 | B4 |
| 3 | ''!C5 | C5 |
| 4 | ''!D6 | D6 |
| 5 | ''!E7 | E7 |
| 1 | ''!A8 | A8 |
+------------+---------------------------------------------------------------+-----------------------------+
=ARRAYFORMULA(IF(LEN(A3:A),SUBSTITUTE(ADDRESS(ROW(A3:A),A3:A,4,1,),"''!",""),))

Filter out all of user's entries if one of them was selected

I am trying to write a formula that will allow you to put up to 3 values into a pool (per person) and then when one of those values is selected for use all 3 potential values are removed from the pool.
My current formula is long but fairly simple in that it takes the values from each user and adds/subtracts them based on whether they are being used.
=(SUMIF($I$2:$I$50, $A24, $L$2:$L$50) + SUMIF($J$2:$J$50, $A24, $L$2:$L$50) + SUMIF($K$2:$K$50, $A24, $L$2:$L$50)) - (SUMIF($A$2:$A$20, $A24, $L$2:$L$20) + SUMIF($B$2:$B$20, $A24, $L$2:$L$20) + SUMIF($C$2:$C$20, $A24, $L$2:$L$20) + SUMIF($D$2:$D$20, $A24, $L$2:$L$20) + SUMIF($E$2:$E$20, $A24, $L$2:$L$20))
The limiting factor here is that each user is adding a potential of 3 values to the pool but when one is selected it is only subtracting that from the pool and then leaving the other 2 which invalidates the pool as a whole.
For reference I have copied the contents over to the following sheet
https://docs.google.com/spreadsheets/d/1tbL1WuaUoR8JM8cndTBiKnoaLm-UxCaddpSOJbCVmiM/edit?usp=sharing
Does anyone have an idea for how to properly remove all available options from the pool rather than just the one that was selected? I have a few ideas from how to possibly make it work with code but I am trying to make it an automated formula rather than something that needs to be specifically "run" to calculate it.
You need some marker against each user to indicate whether their entries are still eligible for taking. Here is an example: column Eligible (L) is True if we haven't chosen from that user yet. Column Selected (N) is filled manually, by choosing from what is available in column Available (O). The formulas are:
For Eligible column (second row shown):
=and(isna(match(I2, N$2:N, 0)), isna(match(J2, N$2:N, 0)), isna(match(K2, N$2:N, 0)))
which says that neither I2, J2, or K2 match anything in N.
And in column O, only one array formula is needed:
={filter(I2:I, L2:L); filter(J2:J, L2:L); filter(K2:K, L2:L)}
which filters out non-eligible users and stacks the foods in one column using array notation {}.
+--------+---------+--------+------------+-----------+--+----------+------------+
| User | Food 1 | Food 2 | Food 3 | Eligible | | Selected | Available |
+--------+---------+--------+------------+-----------+--+----------+------------+
| User A | Chicken | Pear | Watermelon | TRUE | | Grape | Chicken |
| User B | Garlic | Grape | Rice | FALSE | | Beef | Potato |
| User C | Beef | Corn | Salt | FALSE | | | Pear |
| User D | Potato | Pepper | Orange | TRUE | | | Pepper |
| | | | | | | | Watermelon |
| | | | | | | | Orange |
+--------+---------+--------+------------+-----------+--+----------+------------+

google sheets if string matches and is last matching string in set of cells get value of cell nest to it

below is an example of the data in the table
+--------------+------+---------+
| Expense Name | Cost | mileage |
+--------------+------+---------+
| Costco Gas | 20 | 145200 |
| marathon gas | 2 | 145500 |
| oil change | 35 | 145600 |
| marathon gas | 25 | 145750 |
| A/C Work | 305 | 145800 |
| oil change | 36 | 150000 |
+--------------+------+---------+
Whenever the "Expanse Name" string equals "oil change" and it has the highest Mileage from the corresponding mileage I want that mileage to appear in a separate column.
So with this data I would search through the "Expense Name" column and find two that matched the string. From those two I want the one with the higher mileage(150000) to appear.
Another method that doesn't require dragging or array formulae is
=MAX(FILTER(C2:C, A2:A = "oil change"))
let us say expense name is in A1.
In D2 put the formula =COUNTIF("oil change",A2)*C2.
Grab the lower right hand corner handle of the cell and drag it down to copy throughout your data set (in your case D7).
One cell below (D8 in your example), say =MAX of the above cells, so in your case =MAX(D2:D7).
That cell contains your answer.

How do I count all cells in a column that have emoji?

I have a problem with emoji in my production database. Since it's in production, all I get out of it is an auto-geneated excel spreadsheet (.xls) every so often with tens of thousands of rows. I use Google Sheets to parse this so I can easily share the results.
What formula can I use to get a count of all cells in column n that contain emoji?
For instance:
Data
+----+-----------------+
| ID | Name |
+----+-----------------+
| 1 | Chad |
+----+-----------------+
| 2 | ✨Darla✨ |
+----+-----------------+
| 3 | John Smith |
+----+-----------------+
| 4 | Austin ⚠️ Powers |
+----+-----------------+
| 5 | Missus πŸŽ‚ |
+----+-----------------+
Totals
+----------------------------------+---+
| People named Chad | 1 |
+----------------------------------+---+
| People with emoji in their names | 3 |
+----------------------------------+---+
Edit by Ben C. R. Leggiero:
=COUNTA(FILTER(A2:A6;REGEXMATCH(A2:A6;"[^\x{0}-\x{F7}]")))
This should work:
=arrayformula(countif(REGEXMATCH(A2:A6,"[^a-zA-Z\d\s:]"),true))
You cannot extract emojis with regular formula because Google Spreadsheet uses the light-weight re2 regex engine, which lacks many features, including those necessary to find emojis.
What you need to do is creating a custom formula. Select Tools menu, then Script editor.... In the script editor, add the following:
function find_emoji(s) {
var re = /[\u1F60-\u1F64]|[\u2702-\u27B0]|[\u1F68-\u1F6C]|[\u1F30-\u1F70]|[\u2600-\u26ff]|[\uD83C-\uDBFF\uDC00-\uDFFF]+/i;
if (s instanceof Array) {
return s.map(function(el){return el.toString().match(re);});
} else {
return s.toString().match(re);
}
}
Save the script. Go back to your spreadsheet, then test your formula =find_emoji(A1)
My test yields the following:
| Missus πŸŽ‚ | πŸŽ‚ |
| Austin ⚠️ Powers | ⚠ |
| ✨Darla✨ | ✨ |
| joke πŸ˜†πŸ˜† | πŸ˜†πŸ˜† |
And, to count entries that don't have emojis, you can use this formula:
=countif( arrayformula(isblank( find_emoji(filter(F2:F,not(isblank(F2:F)))))), FALSE)
EDIT
I was wrong. You can use regular formula to extract emoji. The regex syntax is [\x{1F300}-\x{1F64F}]|[\x{2702}-\x{27B0}]|[\x{1F68}-\x{1F6C}]|[\x{1F30}-\x{1F70}]|[\x{2600}-\x{26ff}]|[\x{D83C}-\x{DBFF}\x{DC00}-\x{DFFF}]

Trying to find a Google Spreadsheet formula or query for this example

A | B | C | D | E | F | G
name|num|quant|item|quant2
car | 5 | 100 |
| | |wheel| 4
| | |axel | 2
| | |engine|1
truck| 2 | 20 |
| | |wheel| 6
| | |bed | 1
| | | axel| 2
I need a formula which will do B*C*E. the tables look like this, so it needs to be something like
=b$2*c$2*e3 and then dragged.... and then the next set, b$6*c$6*e7 and dragged, etc but i want sure how to get the cieling sort of something. if b5 is empty, look at each above until it finds the one not filled.
I am trying to use this to get total quantity of parts per car, truck etc.... and then group by part.
I dont have a set of DB tables to do this, just a spreadsheet.
I had to add some additional information to resolve this.
I was thinking there would be a way to do a google script that would do this and update the file, but i couldnt seem to find it.
I first summed each group item:
=b$3*e4
and dragged for that grouping.
Then afterwards, i went to a selection of space and wrote up a query.
=query(D:F, "select D,sum(F) group by D")

Resources