D E F
772597 49.36.00 30316
746554 39.33.00 35820
976942 44.46.00 142864
1075820 41.33.00 93708
My dataset needs to be simplified, by that I mean turning numbers into classifications.
For example value less or equal to 99 = 1. 100-999 = 2. 1000-1999 = 3, etc.
I got this code for a column and it works great:
=ArrayFormula(1*(B2:B900*1,05<B3:B900))
But the data in the other columns in the dataset needs to be turned into numeric classes.
I need a formula that transforms the data in column D to be replaced with 1, 2, 3... and same with the data in the other columns
try nesting it:
=IF(AND(D1>0; D1<100); 1;
IF(AND(D1>=100; D1<1000); 2;
IF(AND(D1>=1000; D1<2000); 3; )))
For Numeric columns, please try the likes of:
=ArrayFormula(floor(log(D1:D))--(D1:D<10))
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 am using Google Sheets with the spreadsheet shown below.
I want to Sum the 'Amount' column
IF the Key in column J == the key in column B
AND The Assigned person == the actual person.
So, where the key is 2, we'd have a subset of 7 items. From that the assigned person is Sally and four entries match, our total would therefore be the sum of those matching values which are 20, 10, 2, 4 giving a sum of 36.
In K3, we can correctly see the sum of 36.
The formulae I used in that cell is:
=SUMIFS(H:H,B:B,J3,G:G,D:D)
The cell below has the formulae:
=SUMIFS(H:H,B:B,J4,G:G,D:D)
So, that should, I believe sum the values 3,8 and 4 since the key (3) in column J matches three items in column B. In each case Mike is the assigned and actual person, which means we should be summing 3, 8 and 4. However, the value as you can see is 0.
Any ideas what I'm doing wrong, please?
You can also do this with a single formula in Google Sheets;
=query(B2:H," select B,sum(H) where D=G and B is not null group by B label sum(H) ''")
Use SUMPRODUCT:
=SUMPRODUCT((B$2:B$13=J2)*(D$2:D$13=G$2:G$13)*H$2:H$13)
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)
Link here to spreadsheet
As the title says, how can I end up with cells that don't match in value, the difference/complement (set theory)?
I would prefer it with only FUNCTIONS and no script.
{1,2,3,4}\{1,3} = {2, 4}
or with letters
{a,b,c,d}\{a,c} = {b, d}
or with with space.
{xyz zyx, abc cba, qwe ewq}\{xyz zyx, qwe ewq} = {abc cba}
You can add one single formula at the top of your result column like this :
=arrayformula(if(B2:B=A2:A,,A2:A))
Having two arrays:
Array1 Array2
1 1
2 b
b
4
c
you can get resulting array:
Result
2
4
c
Try this formula:
=FILTER(A2:A6,ROUND(MMULT(ArrayFormula(--(A2:A6<>TRANSPOSE(B2:B4))),TRANSPOSE(SPLIT(REPT(1/ROWS(B2:B4)&"/",Rows(B2:B4)),"/"))),5)=1)
May be too complex for this task, could somebody edit it? Please, look at sample sheet
Edit
I've found more simple way to do this, using Regular Expressions:
=FILTER(A2:A6,REGEXMATCH(ARRAYFORMULA("'"&A2:A6),JOIN("|",B2:B3))=false)
Given a spreadsheet with two columns, say A and B, each containing n values under it, all text; is there a formula that allows me to fill just one cell containing the amount of equal values in columns A and B?
Example:
A B
-----
1 M M
2 L M
3 L L
4 M M
5 M L
-----
3
Since columns A and B both contain an M in rows 1 and 4, and an L in row 3, the result is (i.e. 2+1).
A simple solution is to use QUERY function in google spreadsheet:
=SUM(QUERY(A1:B5, "Select 1 where A = B"))
Or using SUMPRODUCT:
=ARRAYFORMULA(SUM(((A:A)=(B:B)) * (1) ))
One of possible solution will be to add the following formula in column C: =N(EXACT(A1,B1)),
copy it throughout the column down to the last row and then sum up the column C values using =SUM(C1:C5).
Here we go:
=IF(EQ(LEFT(A0, 1), "A"),
SUM(ARRAYFORMULA(N(EXACT(TRANSPOSE(A1:A5), TRANSPOSE(B1:B5))))),
"")
Reading: if the value in row 0 (it doesn't exist, but my example above does ;) ) is equal to the text "A", take the sum of an array N, otherwise put in an empty string. ("")
Array N is build by taking the transpose of columns A and B. (Turning them, so they look like a row) and comparing the values. (Burnash gave me the options "N" and "EXACT") The formula N transforms this into a 1 or 0.
Copy paste the formula in an entire row and what do you know... It worked! That was hellish for something so trivial.
Thanks anyway.