The Set Up:
I have a single column, with three cells.
These cells are drop-down lists. (177 options in the drop-down).
Trying to figure out:
I want to automate matching (if two or all three items match in the same column, to each other) and return a specific number.
Column that needs to match. Output in other column.
So a normal "countif" isn't going to work, as I would need to specify what is being counted. I need it to "see" that there is a match and spit out a specific number.
Sample in works.
if A1 = A2 = A3 = 30 points
if A1 = A2 = 20 points
if A1 = A3 = 20 points
if A2 = A3 = 20 points
if non are same = 10 points
=IF(AND(A1=A2, A2=A3), 30,
IF(OR(A1=A2, A1=A3, A2=A3), 20, 10))
Cries out for COUNTUNIQUE. Assuming relevant dropdowns are in B10:B12 :
=countunique(B10:B12)
and if 1, 2, and 3 are not suitable for the "specific number" then these can be mapped to suitable alternatives (I chose 7 for all the same, 0 if all different, and 3 otherwise):
=choose(countunique(B10:B12),7,3,0)
Related
Background: In the formulas below, I am trying to find any number that has the sequential pattern of +1. Example: 1011 (after 10, comes 11) =(FirstTwo+1=11)=Last 2.
Current Formulas:
A1 =ARRAYFORMULA(ROW(1000:1011)) //List numbers from 1000 to 1011.
B1 =ARRAYFORMULA(LEFT(A1:A,2)) //Only retrieve the first 2 digits.
C1 =ARRAYFORMULA(RIGHT(A1:A,2)) //Only retrieve the last 2 digits.
D1 =ARRAYFORMULA(if((B1:B12+1=C1:C12),TRUE,FALSE)) // If first 2 digits +1 = last 2 digits, TRUE.
Expected Outcome: D12 = TRUE
Actual Outcome: D12 = FALSE
My only found solution (not a good one)
Delete formula in C1.
Manually type each number in column C (resulting in C12 containing "11")
And now the array formula works for D1, and correctly applied TRUE in D12.
Why cant I achieve the same results using the formula in C1?
The problem is that the output data type is text and not an integer. You can test it by using the function type(). Reference document link.
You can fix it by multiplying the outputs by 1. Eg.:
B1: =ARRAYFORMULA(LEFT(A1:A,2)*1)
C1: =ARRAYFORMULA(RIGHT(A1:A,2)*1)
I'm having difficultly with Google Sheets counting unique rows, where other criteria in the formula must also be met.
I've created a simple Google Sheet to highlight the problem I need solving.
https://docs.google.com/spreadsheets/d/1P0sHIUN12Wpbr6vKJAwsPluj-T2H-NrPpQ1_WWV7lvI/edit?usp=sharing
I need the formula in cell C5 to only count unique values in row G, where the criteria is met in rows F & H (the SP is “DG” and the likelihood is “Booked”). I cannot work out how to make this only count unique values. The formula I currently have only counts any cells that are not blank in row G, it does not look for unique values but needs to.
The working formula should give the following answers:
C3 = <> C5 should equal 3
C3 = 1 C5 should equal 1
C3 = 2 C5 should equal 2
C3 = 3 C5 should equal 1
Please can someone help?
EDIT
The formulas I've already tried won't make sense with the example in the link but to show what I have attempted
=COUNTIF(UNIQUE(QUERY(AA:AM,"Select AC where AA = 'DG' and AL = 'Booked' and AM = '" & I2 & "'")),"<>")
It returned a 1 regardless of how many it should have returned.
=COUNTUNIQUE(QUERY(F2:I21,"Select G where F='DG' and H='Booked' "&IF(ISBLANK(C3),,"and I="&C3&"")))
QUERY to get G column subject to conditions
COUNTUNIQUE to count unique G Rows
I have a google sheet that I am using to try and calculate leveling and experience points. Column A has the level and Column B has the exp needed to reach the next level. i.e. To get to Level 3 you need 600 exp.
A B
1 200
2 400
3 600
...
99 19800
In column I2 I have an integer for an amount of exp (e.g. 2000), in column J2 I want to figure out what level someone would be at if they started from 0.
Put this in column J and ddrag down as required. Rounddown(I2,-2) rounds I2 down to the nearest 100. Index match finds a match in column B and returns the value in column A of the matched row.
=index(A2:A100,match(ROUNDDOWN(I2,-2),B2:B100,0))
Using a helper column (for example Z): put =sum(B$1:B1) in cell Z1 and drag down. This will compute the sums required for each level. In J2, use the formula
=vlookup(I2, {B:B, Z:Z}, 2) + 1
which looks up I2 in column B, and returns the nearest match that is less than or equal to the search key. It adds 1 to find the level that would be reached, because your table has this kind of an offset to you: the entry against level N is about achieving level N+1.
You may want to put 0 0 on top of the table, to correctly handle the amounts under 200. Or treat them with a separate if condition.
Using algebra
In your specific scenario, the point amount required for level N can be computed as
200*(1+2+3+...+N-1) = 200*(N-1)*N/2 = 100*(N-1/2)^2 - 25
So, given x amount of points, we can find N directly with algebra:
N = floor(sqrt((x+25)/100)+1/2)
which means that the formula
=floor(sqrt((I2 + 25) / 100) + 1/2)
will have the desired effect in cell J2, without the need for an extra column and vlookup.
However, the second approach only works for this specific point values.
I've conquered a 2-way lookup for one Y axis and one X axis value using
=SUMPRODUCT((Y_AXIS_VALUE_ARRAY = Y_LOOKUP_VALUE)*(X_AXIS_VALUE_ARRAY = X_LOOKUP_VALUE), LOOKUP_ARRAY)
However what if I had multiple Y_LOOKUP values and multiple X_LOOKUP values and wanted to sum the results of all of them in one equation is this possible.
The example below shows what I'm after in this example the formula should return 105.78 (80.45 + 25.33).
The formula mentioned above when used to where X/Y Lookup values are an array of values returns Error
Array arguments to MULTIPLY are of different size.
Here is my test google sheet: https://docs.google.com/a/rentping.com/spreadsheets/d/1GWQHAclo19f1VxLBixI4eyKJDN1QRk6SzXKJDWj6ZaE/edit?usp=sharing
The "Test" sheet contains the interface where X/Y Look up values are selected, and the "Items" sheet contains the table that is being referenced.
Columns L, M, N, O are where the selection is made and Column K is where the formula goes. As you can see when only ONE column has a selection the formula accurately gets the value, but as soon as a second value is selected in the those columns the formula breaks down.
An easier way to perform double lookup is to use filter twice: for rows and for columns. The wrapper iferror suppresses output when nothing is found.
=iferror(filter(filter(Items!A:Z, Items!A:A = L2), Items!A1:Z1 = L3))
With 4 columns to choose from, I'd go with
=iferror(filter(filter(Items!A:Z, Items!A:A = L2), Items!A1:Z1 = L3))
+iferror(filter(filter(Items!A:Z, Items!A:A = M2), Items!A1:Z1 = M3))
+iferror(filter(filter(Items!A:Z, Items!A:A = N2), Items!A1:Z1 = N3))
+iferror(filter(filter(Items!A:Z, Items!A:A = O2), Items!A1:Z1 = O3))
Alternatively, have additional hidden columns with lookups (one hidden column for each input column), and then column K can be a simple sum over hidden columns.
I am trying to set up a table which is to be filled in with the word "Credit" based on the number of courses taken by an individual that apply (are from the English category).
In my example, the list on the left represents the courses taken by an individual, with the table at the top used as a reference as to which courses will satisfy with the English requirement.
Is it possible to fill in the table with the word "Credit" based on the number of matches found in the list of courses completed?
You can use conditional statements to test for those values and tally them
In your example, the Code:
=IF(OR(A3 = $D$3, A3 = $D$4, A3 = $D$5, A3 = $D$6, A3 = $D$8), 1, 0)
I've placed this code in column B in cell B3. I can than click and drag on the plus sign to fill the cells below it adjacent to all of the A column entries and it will test them against the values referenced in your D column.
I could put these functions anywhere in my workbook I wanted, but since your B column is empty, it makes it easy for me visually to verify that we have a 1 where we should and a zero where we should. Then you can auto-sum the column and voila, your number of English credits, which you can use for whatever you wish. If you really want to have all of the duplicate words in your table, you can skip the ones and zeros and put:
=IF(OR(A3 = $D$3, A3 = $D$4, A3 = $D$5, A3 = $D$6, A3 = $D$8), "Credit", "")
Directly into your table (changing A3 to A4, A5, etc. as needed).
Good Luck!