i am trying to Match two columns, say column A (2, 3, 4, 5, 5, 6, 7) and column B (2, 3, 4, 5, 6, 7) using IF(ISERROR(MATCH(A1,$B$1:$B$8,0)),"",A1).
The formula matches all values correctly but for the fives. It does match both 5's in column A with the single 5 in column B. whereas I expected it to pick one 5 in column A and matching with that in column B leaving the other 5 pending. Anyone have an alternative formula to the one above? Thanks
Assuming you are copying the formula down in another column, you could use COUNTIF to see if the number has already occurred in that column:-
=IF(OR(ISERROR(MATCH(A2,$B$2:$B$7,0)),COUNTIF(C$1:C1,A2)),"",A2)
(I am adding headers and starting in row 2).
Related
Data looks like this:
A B C D E F G ... offset
1 #N/A #N/A 12 14 #N/A #NA #N/A -3
Right now I have a long nested formula that looks like this:
=IF(ISNA(G1)=FALSE,0,IF(ISNA(F1)=FALSE,-1,IF(ISNA(E1)=FALSE,-2,IF(ISNA(D1)=FALSE,-3,IF(ISNA(C1)=FALSE,-4,IF(ISNA(B1)=FALSE,-5,IF(ISNA(A1)=FALSE,-6,-7)))))))
I am constantly editing and adding new columns which makes updating the forumla a pain in the butt. Is there an easier way to automate the formula so that it can find the column of the first non #N/A entry when looking from right to left? So that when I add new columns between F and G, for instance, it will expand it scope without me having to?
I would like to avoid VB if possible here and keep this as a formula.
Try,
=aggregate(14, 7, column(a:z)/(A1:Z1<>""), 1)
=address(1, aggregate(14, 7, column(a:z)/(A1:Z1<>""), 1))
=index(1:1, 0, aggregate(14, 7, column(a:z)/(A1:Z1<>""), 1))
The 0, -1, -2 result is just maths.
I have a spreadsheet that contains users in each column. Below each user lists groups that they are in.
I want to highlight values that are not in every column.
If a user is part of a group that everyone is a part of, that group would not be highlighted.
If there was even one person who wasn't part of that group as well, that group would be highlighted.
Example.
Say there are 3 columns: A, B, C.
Column A has values 1, 2, 3, 4, 5 listed below it. Each number in a different row
Column B has values 1, 2 ,4, 5 listed below it.
Column C has values 1, 2, 4, 6, 7 listed below it.
In this example
In Column A, 3 and 5 would be highlighted.
In Column B, 5 would be highlighted.
In Column C, 6 and 7 would be highlighted.
Because each of those numbers are not listed every column.
So, you can do this using Conditional Formatting using the following logic:
Just for the sake of example, suppose your data is in the range A1:H20 with, as you said, each column being a new user and the first row A1:H1 being user names.
What this tells us:
COUNTA($A$1:$H$1) = Number of users
COUNTIF($A$1:$H$20,A2) = Number of times the value in A2 appears in your dataset
Therefore if COUNTIF($A$1:$H$20,A2) < COUNTA($A$1:$H$1), that means the value in A2 does not appear in each column (otherwise they woud be equal). (Also note that this is based on the assumption that you can't have a value appearing twice in a given column!).
At this point, it's a simple conditional formula.
Hope this explains it well enough.
I have an Excel file which contains two sheets, one holds a list of specific usernames (say in column A) and the other one holds the complete list of usernames (column A) and also the cities (column B).
I need a formula to match usernames between these two sheets and then have the related cities next to the usernames at the first sheet, for example in column B of it.
Here is what I tried at column B of the second sheet but didn't succeed:
=VLOOKUP(A1&"", Sheet1!$A$1:$B$1000, 2, FALSE)
I've also replaced the first argument with A1+0 and also the second one without any $ signs if it helps anyway.
Here is the entire of my original formula:
=IF(ISERROR(VLOOKUP(B1&"", Sheet1!$M$1:$N$1170, 13, FALSE)), VLOOKUP(B1&"", Sheet1!$N$1:$V$1170, 22, FALSE), VLOOKUP(B1&"", Sheet1!$M$1:$N$1170, 13, FALSE))
It suppose to take the username from column B of Sheet2 (the first one described above which only has the specific list of usernames) and search for the match in column N of Sheet1 (the second described sheet which has username and city inside), then return the value of city which is placed on column M but if it has a #N/A error (which is probable), return the V column instead which also holds the city name on the rows those have no city name in their M column.
You could use a VLOOKUP to look up the items from B in the list of A. If it doesn't find a match, VLOOKUP will return #N/A. You could also combine this with an IF statement so that if it's missing, it'll give you some message. For example, in C1 enter
=IF(ISNA(VLOOKUP(B1, $A$1:$A$1957, 1, FALSE )), "MISSING", "MATCHED!")
and copy/paste this formula all the way down your column of "B" figures to check.
this will start by looking up B1 in the range of A1:A1957. If it does not find a match it will return NA. Then we combine this with an IF statement so that IF VLOOKUP results in NA, we give a message of "MISSING". If it's not NA then there it means we found a match, so we give a message of "MATCHED!".
obviously you can change the missing/matched message to whatever you like.
best online MBA
A few comments:
1) Why: B1&"", ? Try: B1,
2) Both the lookup column 13 and 22 can't be possible if the lookup table is only 2 column's. So these values should either be 2, or you need to expand the column range up to the amount you wish to retrieve the data from.
You need to count the amount of columns starting from the first lookup column in your range so ... if the data to retrieve from column M to column N is in column N, then this should be 2. For N up to V, this should be 9. TRY:
=IF(ISERROR(VLOOKUP(B1&"", Sheet1!$M$1:$N$1170, 2, FALSE)), VLOOKUP(B1&"", Sheet1!$N$1:$V$1170, 9, FALSE), VLOOKUP(B1&"",
Sheet1!$M$1:$N$1170, 2, FALSE))
In the original formula (from second part), your range starts from the wrong column: should start with the column which has the matching lookupvalue. I assume column A. From column A, it's 22 columns to V, and 13 columns to N. The correct formula should then be:
=IF(ISERROR(VLOOKUP(B1&"", Sheet1!$A$1:$N$1170, 13, FALSE)), VLOOKUP(B1&"", Sheet1!$A$1:$V$1170, 22, FALSE), VLOOKUP(B1&"", Sheet1!$A$1:$N$1170, 13, FALSE))
If for example you have the matching username in for example B, the formula should be:
=IF(ISERROR(VLOOKUP(B1&"", Sheet1!$B$1:$N$1170, 12, FALSE)), VLOOKUP(B1&"", Sheet1!$B$1:$V$1170, 21, FALSE), VLOOKUP(B1&"", Sheet1!$B$1:$N$1170, 12, FALSE))
I am trying to calculate a formula and then dragging it to apply it for the whole column but the problem is that I want to compare first cell of the column A with the first cell of the column B and then second cell of the column A with the second cell of the column B and then compare third cell of the column a with the first cell of the column B... :
A B result
1 1 4 0
2 2 5 0
3 3 0
4 4 0
5 5 1
6 5 1
when i write the pattern like if =IF((A1<Sheet1!B1),0,1) then =IF((A2<Sheet1!B2),0,1) ,=IF((A1<Sheet1!B1),0,1),=IF((A2<Sheet1!B2),0,1)
Four times and then dragging the formula for the column it start comparing it with the correspond one =IF((A5<Sheet1!B5),0,1) How should i change it ?
edit :
in the example I want to compare cell(1,A) with cell(1,B) then cell (2,A) with cell (2,B) and then cell(3,A) with cell(1,B) then cell (4,A) with cell (2,B) and then cell(5,A) with cell(1,B) then cell (6,A) with cell (2,B).[repeating the pattern two times and then start over]
Try this in C1,
=--NOT(A1<OFFSET('Different Sheet'!$B$1, MOD(ROW(1:1)-1, 2), 0))
Fill down as necessary. You only seem to be looking for a 0 or a 1 so I've simplified your IF statement. (Note: maths with MOD adjusted for more universality)
For different multiples you should only have to change the divisor parameter of the MOD function. The ROW function used as ROW(1:1) will return 1, 2, 3, 4, 5, etc as you fill down. MOD returns the remainder of a division operation so MOD(ROW(1:1)-1, 3) filled down will return 0, 1, 2, 0, 1, 2, 0, etc.
If you used the COUNT function on the numbers in 'Different Sheet'!B:B, you should be able to achieve a dynamic divisor.
=--NOT(A1<OFFSET('Different Sheet'!$B$1, MOD(ROW(1:1)-1, COUNT('Different Sheet'!B:B)), 0))
I have a list of Excel data set up like this.
Items
1, 11, 3
4, 5, 6
7, 9, 12
15, 13, 4
7, 8, 9, 10, 1
14
1, 3, 7, 9
I want to make a count of each occurring number, so that I end up with a result like this:
Items A2 Column
1 2
2 0
3 2
4 2
5 1
And so on. Are there any formulas I can use to count the frequency of each number?
I've tried using the COUNTIF function, but the formula will often come out as 0 because it can't read each number separately in the cells. Using a Pivot Table created the same results as well.
First split those integer values into their own cell:
Data>>TextToColumns>>Delimited>>Comma>>OK
Second set up a table where 1 through whatever is listed in the rows, then you can use countif() to get the counts.
=COUNTIF($A$2:$E$8,A14)
Where $A$2:$E$8 is the group of cells that was created with Text To Columns, and A14 is the first cell in your list of of 1 to whatever. Copy that down to each row in your list of 1 to whatever and you'll have what you are looking for.
Assumptions Made:
-Your data is all in column A but in multiple rows.
-Each cell in column A has one or more comma separated data sets (as shown above)
In Column D1 Place a Title "Items" and enter your item numbers in column D starting with D2 and continuing.
In Column E use the following Formula
=SUM(COUNTIF($A:$A,D2&","),COUNTIF($A:$A," "&D2),COUNTIF($A:$A,", "&D2 &","),COUNTIF($A:$A,D2))
Explanation:
COUNTIF($A:$A,D2&",*") - finds entries for the specified item that are the first item in a data set with more than one item listed
COUNTIF($A:$A,"* "&D2) - finds entries for the specified item that are the the last item in a data set with more than one item listed
COUNTIF($A:$A,", "&D2 &",") - finds entries for the specified item that are neither the first, nor the last item in a data set with more than one item listed
COUNTIF($A:$A,D2) = Finds entries for a specified item where the data set only contains one item.