Find a match on two excel columns - excel

I want to compare data between two tables on excel and get the cells that match in two columns.
i.e:
Look for the value from cell G9 in column A, if found the check if the value of cell J9 Equals to cell D of the row in which the first match was found.
I tried Vlookup, index and match, but I'm still missing a function to complete the syntax
=IF(VLOOKUP(G9,$A$9:$D$1127,1,FALSE),IF(J9=D,"","new"),"new")
I don't know what to insert instead of D
Sample: https://drive.google.com/open?id=1aJZlpQ2V-bmwmS1Kwk-OIiSvXR552JJH

You can use MATCH on an array premises. If you want the number of the line when the values of G9 and J9 occur on columns A:A and D:D simultaneously, use the formula:
{=IFERROR(MATCH(J9,IF(A:A=G9,D:D),0),"No Match")}
If you want to return just the word "new" in case of a valid match use:
{=IFERROR(IF(MATCH(J9,IF(A:A=G9,D:D),0)>0,"new",""),"")}
Don't forget to use Ctrl + Shift + Enter to place the braces on the formula.
EDIT:
Since I'm having some troubles with showing my solution, I'll be more thorough.
Let's imagine you have the following worksheet:
For each row in the first table, if you want to check a match on the second table, you could place the formula
{=IFERROR(IF(MATCH(A1,IF(E:E=B1,D:D),0)>0,"new",""),"")}
on cell C1 and drag it to the end (to C22 on my example). You will get the next result:
Please, don't forget to press Ctrl + Shift + Enter when you're entering the formula on cell C1.

Related

excel: list all values of a column of a range based on a condition

I have a range in a Excel Sheet table that contains 2 columns like A and B.
I want to list in another column all values from column A if the corresponding value in column B is not null.
I know a way to do it, but it produces a lot of "empty raws" like in column C
=if(B<>"";A;"")
I would like to do it in a compact way, with no "empty raws" like in column D
Here is an example for data down to row #19. In C1 enter the array formula:
=IFERROR(INDEX($A$1:$A$19,SMALL(IF($B$1:$B$19<>"",ROW($B$1:$B$19)),ROW(1:1))),"")
and copy downwards. (You may need to use semi-colons in place of commas)
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.

How to lookup a value and Index Match Table if a Date is between 2 dates with criteria?

I would like to look up first ID match with second ID, if found then match first date with the given range date within same raw and then add type of leave according to the first date if matched
by using Vlookup / Match index /if
Assuming the columns shown are A to H, starting in row 1, this is the formula for C2:
=INDEX($F$2:$F$7,MATCH(1,(A2=$E$2:$E$7)*(B2>=$G$2:$G$7)*(B2<=$H$2:$H$7),0))
Note that this is an array formula. For it to work, you need to double click in cell C2 so you're in edit mode, then paste in the formula, then press CTRL-SHIFT-ENTER to save the formula.
You'll need to adjust the references to columns E,F,G and H to include all rows. Remember to press CTRL-SHIFT-ENTER each time.

Excel Max Length of each column data

Simple one for someone hopefully. I'm trying to get the max length of each column in an excel sheet but it doesn't seem to be working now. I was using =MAX(LEN(A2:A200)) for example and because MAX is not an "official" formula but is still there you seem to have to press CTRL + ALT + SHIFT once you have finished typing it.
When I do this it puts curly brackets round the whole formula like this {=MAX(LEN(A2:A200))} but if I click into the cell they disappear. the length of the first column will appear but then if I autofill to the next column it shows same length of column data from the first column rather than calculating the next column.
Perhaps not a straight up programming question but scratching my head why this is not working now. I'm trying to show max length of each column above header column in new row.
Thanks
Andrew
In A1 enter the array formula:
=MAX(LEN(A2:A200))
then stop clicking.
Move to A1 with the ARROW keys. Touch Ctrl+c. Then paste to B2 through G2 using Ctrl+v:
This will put the array formula in the destination cells.
Use Gary's formula and instead of ENTER, do CTRL-SHIFT-ENTER
When I do this it puts curly brackets round the whole formula like this {=MAX(LEN(A2:A200))} but if I click into the cell they disappear. the length of the first column will appear but then if I autofill to the next column it shows same length of column data from the first column rather than calculating the next column.
It is right to use formulas with brackets (they are called Matrix formulas). The brackets disappears because when you edit the content of the cell you have to push Ctrl + Shift + Enter and not only Enter like normal formulas.
Let's assume all your data is in Sheet1 starting at cell A1.
Create Sheet2
Enter the =LEN(Sheet1!A1) formula in cell A1 on Sheet2
Pull Sheet2's A1 cell down/over to the right to cover the populated
range of Sheet1 (to copy the formula to every cell of the range in
scope) - this will give you the length of every cell in scope
Enter the =MAX(A1:A10) formula on Sheet2 in the first column below
the last line (A10 is assumed to be the last line of the first
column in this example - so the formula goes in A11)
Pull Sheet2's A11 cell over to the right till the last column to get
the MAX length of values for each column

Complex Excel lookup with results

Column A holds all the values that are used to find/search in entries within Column B.
For example... Excel will grab all the search data from column A, if it finds any of those entries anywhere in column B then it marks the cell where it found a match as Yes in column C.
Please note that in the example below A1 is (111) and B13 is (2211122). As (111) was found within that string then it has found what it is looking for and marked it as yes.
You can use folloiwng array formula:
=IF(SUM(IFERROR(FIND($A$1:$A$9,B1),0))>0,"Yes","No")
Just select C1 cell, enter this formula in formula bar, press CTRL+SHIFT+ENTER to evaluate it and then drag it down.
UPD:
If your substrings in column A has spaces in the beggining or in the end, you can use next function:
=IF(SUM(IFERROR(FIND(TRIM($A$1:$A$9),B1),0))>0,"Yes","No")

How to count blanks in a row, after first Non Blank cell of that Row

For instance i have a range "B3:AY3" and first non blank cell that contains value is "R3", i need to count all blank cells after cell "R3"
This formula must be array-entered:
A3: =COUNTBLANK(OFFSET(MyRange,0,MATCH(
TRUE,LEN(MyRange)>0,0)-1,1,COLUMNS(
MyRange)-MATCH(TRUE,LEN(MyRange)>0,0)+1))
where MyRange = B3:AY3
and fill down as needed
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
ctrl-shift while hitting enter. If you did this
correctly, Excel will place braces {...} around the formula.
The above formula will return an error message if there are ONLY blank cells in the range, or if there are any cells in the range which contain an error. If that is a problem, use the following array-entered formula instead:
=IFERROR(COUNTBLANK(OFFSET(MyRange,0,MATCH(
TRUE,IFERROR(LEN(MyRange)>0,TRUE),0)-1,1,COLUMNS(
MyRange)-MATCH(TRUE,IFERROR(LEN(MyRange)>0,TRUE),0)+1)),COLUMNS(MyRange))
IT will count errors as being non-blanks, and count all the cells if all are blank.
and first non blank cell that contains value is "R3"
I have taken the example for Row 1. Amend as applicable :)
Try This
=COUNTBLANK(INDIRECT(ADDRESS(1,MATCH(TRUE,LEN(A1:AY1)=0,0)) & ":AY1"))
Enter this as an Array Formula. i.e you have to press Ctrl + Shift + Enter instead of Enter
For 3rd row, the formula becomes
=COUNTBLANK(INDIRECT(ADDRESS(3,MATCH(TRUE,LEN(A3:AY3)=0,0)) & ":AY3"))
If you only need it to work for row three then use the following:
=COUNTBLANK(B3:AY3) - (MATCH(TRUE,INDEX((B3:AY3<>0),0),0)-1)
This is a regular formula and will not need to be entered as an array, also as I am not using any Volatile function (like INDIRECT and OFFSET) in should also be much better performance wise.
All I m doing is counting all blanks, then subtracting all the blanks before the first cell with a value.

Resources