I have these two sheets, that I'm using to keep track of my work. In one of the sheets, I have my overview, where I can see all of my tasks at hand. In other sheets, I have the different jobs I'm currently doing.
Now... I'm looking for at formula for Microsoft Excel, where I can do the following:
="GET THE HIGHEST ROW-NUMBER, IN A CERTAIN COLUMN, THAT ISN'T EMPTY, AND PUT THE TEXT FROM THAT COLUMN INTO ANOTHER CELL" (see examples of it further down)
Examples:
Let's say, that I insert this formula into D10, and to check the entire A-column, then this would be the result
Ex.1
A B C D
1 Foo
2 Bar
3 Is
4 An
5 Apple
6 From
7 Chile
8
9
10 Chile
Ex.2
A B C D
1 Foo
2 Bar
3 Is
4 An
5 Apple
6
7
8
9
10 Apple
Ex.3
A B C D
1 Foo
2 Bar
3 Is
4
5
6
7
8
9
10 Is
Ex.4
A B C D
1 Foo bar is
2 Also an
3 Egyptian God
4 Of pie
5
6
7
8
9
10 Of pie
On a last remark... Then I'm using this stupid danish version of Excel, so if you're a dane trying to solve this, then a danish formula would be 'B-E-A-UTIFUL'.
And remember, that it has to work across different sheets.
MY ATTEMPTS:
I Google around for about an hour... I found this, which I tried to understand:
=INDIRECT(CONCATENATE("R",MATCH(MAX(S4:S5),S4:S5,0)+3))
But I couldn't get it to work, because of this stupid danish Excel. I tried to understand it, then - and figured out, that it parsed and concatenated area as text and inserted that into the field - so I guess that wouldn't do the trick anyways.
Then my idea was to try to loop through all the cells in a column and check each of the cells, if they weren't empty, and if their row-number where higher than then previous. I quickly gave up on that one, because I couldn't find a way to make a for loop in Excel.
Then I've tried all other sorts of things (mainly experimenting with the MAX()-function).
If your data is in a sheet called data then try this formula to get the last text value in column A of that sheet
=LOOKUP(REPT("z";255);Data!A:A)
In Danish that should be
=SLĂ….OP(GENTAG("z";255);Data!A:A)
Related
I have a list of part numbers that are used in 4 different top level assemblies. The parts can be used in 1 to 4 of the top level assemblies. I'm trying to write a formula that will count how many unique top level assemblies a part number occurs in. I had previously written a formula that worked, but it uses UNIQUE and FILTER, and my coworkers don't have Excel 365, so those formulas aren't supported for them. I've been trying to come up with a workaround and would really appreciate any help :)
I have an example (I can't provide any real data) section of our spreadsheet and an image of the formula I had that was working
Top Level Assy
Part Number
Qty
Number of times used
02554
01622
4
3
89975
01622
4
3
95665
01622
4
3
98886
01723
4
1
98886
01723
10
1
98886
01723
4
1
02554
01734
4
3
89975
01734
4
3
95665
01734
4
3
02554
01740
6
3
89975
01740
6
3
95665
01740
6
3
02554
01746
5
3
89975
01746
5
3
95665
01746
5
3
02554
01835
2
3
89975
01835
2
3
95665
01835
2
3
02554
51205
4
3
=SUM(--(LEN(UNIQUE(FILTER(A:A, C:C=C2, "")))>0))
Picture of the excel sheet
Picture of working formula
Use the following formula in row 2: =SUMPRODUCT(--(FREQUENCY(IF($B$2:$B$20=$B2,$A$2:$A$20),$A$2:$A$20)>0))
*I think it doesn't require ctrl+shift-enter in older Excel versions, since SUMPRODUCT is an array formula by default.
The formula checks the frequency of values in column A where column B matches the value in the current row. It returns the count per unique value meeting the condition. Wrapping it in -- & >0 returns 1 for each unique value. SUMPRODUCT sums them.
Edit:
I realized that the top level assembly values are actual text, not numeric values. In that case (since it's all numeric values stored as text) you can use this workaround:
=SUMPRODUCT(--(FREQUENCY(IF($B$2:$B$20=$B2,--($A$2:$A$20)),--($A$2:$A$20))>0))
It converts the text to numbers.
Sidenotes to this workaround:
If any value would contain a character other than numeric it will not get counted.
If you have both values like 02554 and 2554 they'll both get converted to 2554 and counted likewise.
Edit 2:
For text use the following:
=SUMPRODUCT(IF($B$2:$B$20=$B2, 1/(COUNTIFS($B$2:$B$20, $B2, $A$2:$A$20, $A$2:$A$20)), 0))
enter image description here
I want to sum all these data given in right side to my format. I tried many time and many formulas but some things left every time. Please help
You can achieve most of what you need with a mixture of formulae and a pivot table. But I couldn't quite get everything you wanted, as some of it doesn't make sense. For example, you have 2013 - 2012 - <5 as your first row header, but there are multiple years that give an age less than 5, e.g. 2014 - 2013 - <5 would also be valid. I would suggest hardcoding the years somehow, as they aren't entirely relevant anyway?
Breaking it down into separate problems.
How do I get the Roman number version of the Class?
You could have a massive IF statement, but I went for a VLOOKUP. You could have used the ROMAN built in function, but you can't because your numbering is "first", "second", etc. instead of "1", "2", etc.
So I actually went for both solutions, just to show how they both work. First I created a named table (list object) called "Named" that looks like this:
Class Class Number
First 1
Second 2
Third 3
Fourth 4
etc.
I then used this to VLOOKUP your class names and convert them into numbers. Next I used the ROMAN function to make this into roman numeral format. So I ended up with this (columns E, F and G in my worksheet):
Class Class Number Roman
First 1 I
First 1 I
First 1 I
First 1 I
First 1 I
Second 2 II
Third 3 III
Fourth 4 IV
With formulae:
Class Number - =VLOOKUP(E2,Named,2,FALSE);
Roman - =ROMAN(F2).
How do I get from "Male"/ "Female" to "B"/ "G"?
This was trivial, just =IF(A2="Male", "B", "G") where I have Gender in column A.
How do I get the "age text" so it handles "<5" and ">22"?
My age was in column D, so this was also trivial, =IF(D2<5,"<5", IF(D2>22, ">22", D2)).
Now I have enough data to pivot, so I selected my entire table, which was basically your sample data with calculated columns added to the right. Then I inserted a pivot table and dragged in row/ column headers to make it match your format. This doesn't give you the year columns, but it gives you everything else. For example, just using a few random rows of sample data (as I couldn't be bothered to type it all in):
I went from:
Gender Date of Birth Age Class
Male 06-Jan-14 4 First
Female 07-Sep-11 6 First
Male 01-Jan-12 6 First
Male 31-Dec-12 5 First
Female 01-Oct-11 6 First
Female 16-Nov-10 7 Second
Male 31-Oct-09 8 Third
Male 25-Oct-10 7 Fourth
To:
I II III IV
B G G B B
<5 1
5 1
6 1 2
7 1 1
8 1
Total 3 2 1 1 1
From here you could simply hardcode the columns A and B from your desired final format, as these years aren't actually based on the data?
I have strings of spreadsheet data that need counting by 'type' but not instance.
A B C D
1 Lin 1 2 1
2 Tom 1 4 2
3 Sue 3 1 4
The correct sum of students assigned to teacher 1 is 3, not 4. That teacher 1 meets Lin in lessons B and D is irrelevant to the count.
I borrowed a formula which works in Excel but not in Google Sheets where I and others need to keep and manipulate the data.
F5=SUMPRODUCT(SIGN(COUNTIF(OFFSET(B$2:D$2, ROW($2:$4)-1, 0), E5)))
A B C D E
2 Lin 1 2 1
3 Tom 1 4 2
4 Sue 3 1 4
5 1 [exact string being searched for, ie a teacher name]
I don't know what is not being understood by Google Sheets in that formula. Does anyone know the correct expression to use, or a more efficient way to get the accurate count I need, without duplicates within rows inflating the count?
So this is the mmult way, which works by finding the row totals of students assigned to teacher 1 etc., then seeing how many of the totals are greater than 0.
=ArrayFormula(sum(--(mmult(n(B2:D4=E5),transpose(column(B2:D4)))>0)))
or
=ArrayFormula(sum(sign(mmult(n(B2:D4=E5),transpose(column(B2:D4))))))
Also works in Excel if entered as an array formula without the ArrayFormula wrapper.
A specific Google Sheets one can be quite short
=ArrayFormula(COUNTUNIQUE((B2:D4=E5)*row(B2:D4)))-1
counting the unique rows containing a match.
Note - I am subtracting 1 in the last formula above because I am assuming there is at least one zero (non-match) which should be ignored. This would fail in the extreme case where all students in all classes are assigned to the same teacher so you have a matrix (e.g.) of all 1's. This would be more theoretically correct:
=ArrayFormula(COUNTUNIQUE(if(B2:D4=E5,row(B2:D4),"")))
If two households share, they create a tie and this tie has a kinship rank that does not change, no matter how often two households share with each other.
KINSHIP RANK EXAMPLE
As you can see, it doesn't matter in which "direction" the tie happened whether it was household 5 who shared to household 3 or vice versa, the kinship rank is still 1
HH1 HH2 RANK
5 3 1
3 5 1
Therefore, I do not need every tie that occurs between two households, but only the first instance that a tie occurred between the two households.
So here is a sample list of many households who shared with each other, sometimes sharing resources with themselves, sharing only once, or sharing multiple times with the same household.
TWO HOUSEHOLD WITH REPEATED TIES
COL.A COL.B
ROW HH1 HH2
1 1 1
2 1 2
3 1 3
4 2 1
5 2 4
6 3 1
7 3 2
8 3 4
9 4 2
This is what I need it to look like:
TWO HOUSEHOLDS WITHOUT REPEATED TIES
COL.A COL.B
ROW HH1 HH2
1 1 1
2 1 2
3 1 3
4 2 4
5 3 2
6 3 4
What I have done
I wrote a simple command for placing the HH1 and HH2 information into the same cell:
=A1&"|"&B1
In the case of the second row, this looks like 1|2 inside cell C2
HH1 and HH2 are combined in column C so how will I be able to compare all of the households in column C to each other? Perhaps a highlighting rule if a repeat happens? Or in another column list if it is a delete or a keep?
Thank you for your assistance everyone.
I suggest a simple COUNTIFS to do the job like this:
=(COUNTIFS(A$1:A1,B2,B$1:B1,A2)+COUNTIFS(A$1:A1,A2,B$1:B1,B2))>0
starting in C2 and then copy down. It will show TRUE for each row which is within the range above it and false if not. Ich checks for both x/y and y/x (the order doesn't matter)
Now simply filter col C to only show rows with TRUE in it. Then simply select and delete it.
This also works with non numerical values like names.
If you still have any questions, just ask ;)
You also can wrap it up to get more informations like this:
=IF((COUNTIFS(A$1:A1,B2,B$1:B1,A2)+COUNTIFS(A$1:A1,A2,B$1:B1,B2)),"",COUNTIFS(A:A,B2,B:B,A2)+COUNTIFS(A:A,A2,B:B,B2))
For C2 and copy down. C1 gets:
=COUNTIFS(A:A,B2,B:B,A2)+COUNTIFS(A:A,A2,B:B,B2)
This will show you only at the first occurrence how many times it is within the whole range.
All done by phone, may contain errors
Use =((A1*B1)/(A1+B1))*((A1*B1)+(A1+B1)) to create unique identifiers. Then use Remove Duplicates in the Data Tools Pane of the Data Tab to remove all rows containing duplicates. Or, alternatively, use something like =IF(IFNA(MATCH(A2,A$1:A1,0),TRUE())=TRUE,"First Share","") dragged and dropped from row 2 to identify First Shares.
I'm not sure how to ask this question without illustrating it, so here goes:
I have results from a test which has tested peoples attitudes (scores 1-5) to different voices on a 16 different scales. The data set looks like this (where P1,P2,P3 are participants, A, B, C are voices)
Aformal Apleasant Acool Bformal etc
P1 2 3 1 4
P2 5 4 2 4
P3 1 2 4 3
However, I want to rearrange my data to look like this:
formal pleasant cool
P1A 3 3 5
P1B 2 1 6
P1C etc
P1D
This would mean a lot more rows (multiple rows per participant), and a lot fewer columns. Is it doable without having to manually reenter all the scores in a new excel file?
Sure, no problem. I just hacked this solution:
L M N O P Q
person# voice# formal pleasant cool
1 1 P1A 2 3 1
1 2 P1B 4 5 2
1 3 P1C 9 9 9
2 1 P2A 5 4 2
2 2 P2B 4 4 1
2 3 P2C 9 9 9
3 1 P3A 1 2 4
3 2 P3B 3 3 2
3 3 P3C 9 9 9
Basically, in columns L and M, I made two columns with index numbers. Voice numbers go from 1 to 3 and repeat every 3 rows because there are nv=3 voices (increase this if you have voices F, G, H...). Person numbers are also repeated for 3 rows each, because there are nv=3 voices.
To make the row headers (P1A, etc.), I used this formula: ="P" & L2 & CHAR(64+M2) at P1A and copied down.
To make the new table of values, I used this formula: =OFFSET(B$2,$L2-1,($M2-1)*3) at P1A-formal, and copied down and across. Note that B$2 corresponds to the cell address for P1-Aformal in the original table of values (your example).
I've used this indexing trick I don't know how many times to quickly rearrange tables of data inherited from other people.
EDIT: Note that the index columns are also made (semi)automatically using a formula. The first nv=3 rows are made manually, and then subsequent rows refer to them. For example, the formula in L5 is =L2+1 and the formula in M5 is =M2. Both are copied down to the end of the table.