Assistance writing the LEFT function in the INDEX MATCH EXCEL Formula - excel

I am having an issue with the INDEX MATCH formula. This is the formula below. My problem is the cell I am trying to match is 15 characters but the target cell is 18 characters. I tried the LEFT function but it's returning N/A.
Can anyone please help me with my formula? I don't use excel a lot.
=INDEX('[HOCS LIST.xlsx]Sheet1'!$B$2:$B$70541,MATCH(LEFT(F3,14),'[HOCS LIST.xlsx]Sheet1'!$A$2:$A$70541,0))
The Target spreadsheet as you can see is 18 characters but the first 15 are exactly the same. I want my formula to look for the first 15, not the whole 18.
Thank you
I've tried the LEFT function to look for 15 characters but I still get the N/A result.

I think you just have the columns flipped... You don't want the first 15 characters of column F. From the screenshot that is the shorter cell, you want to compare it to column A...
=INDEX('[HOCS LIST.xlsx]Sheet1'!$A:$B,MATCH($F3,LEFT('[HOCS LIST.xlsx]Sheet1'!$A:$A),0),2)
That being said I adjusted your index to include BOTH columns A:B along with adjusting it to return column 2 (B) assuming that's what you are looking for?

Related

want to merge two column that contains mobile number into one based on the condition that mobile no should be 10 digits

I am new to excel please help me.
So the situation is we have two contact no column
contact no contact no 1
9864573828 0145883
9834765849 1923832
018294 9876547834
i want to merge two column into 1 having contact no of 10 digit.
contact no
9864573828
9834765849
9876547834
I'm using Excel 2013
In Excel 2013 this formula can be used to list the 10 digit numbers from the first and second range without gaps:
=IFERROR(IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW(A:A)/(LEN(A:A)=10)/(ISNUMBER(--A:A)),ROW(1:1))),INDEX(B:B,AGGREGATE(15,6,ROW(B:B)/(LEN(B:B)=10)/(ISNUMBER(--B:B)),ROW(1:1)-SUMPRODUCT((LEN(A:A)=10)*(ISNUMBER(--A:A)))))),"")
It uses a lot of resources to calculate, so whole column references is highly discouraged. So use actual ranges instead like:
=IFERROR(
IFERROR(
INDEX(A:A,
AGGREGATE(15,6,
ROW($A$2:$A$5)
/(LEN($A$2:$A$5)=10)
/(ISNUMBER(--$A$2:$A$5)),
ROW(1:1))),
INDEX(B:B,
AGGREGATE(15,6,
ROW($B$2:$B$5)
/(LEN($B$2:$B$5)=10)
/(ISNUMBER(--$B$2:$B$5)),
ROW(1:1)
-SUMPRODUCT(
(LEN($A$2:$A$5)=10)
*(ISNUMBER(--$A$2:$A$5)))))),
"")
Note: I think (unable to verify myself) the formula needs entered with ctrl+shift+enter to make it an array formula.
What this formula does is get the first row of the first range where the string length is 10 and the string converted to a number does not produce an error (what would happen in case of text characters in the string).
When you drag down the formula it shows the second found, third, etc... until no values are found in the first range anymore.
In that case the IFERROR makes it look for the same logic in the second range.
As we want it to show the first found value first, we can't reset the ROW(1:1) * - that is used as a counter for the first smallest, second smallest, etc.. - * therefore we use the same counter and use SUMPRODUCT to subtract the total number of strings meeting the conditions in the first range. That way the counter will start at 1 for the second range and starts counting from there.
If no more values are found in the second range it will show a blank value.
So you can drag down the formula up to the first blank result to show each result.
It's probably still slow with actual range references. I highly advise to upgrade to Office 365.
Try the following formula-
=LET(x,TOCOL(A2:B13,1),FILTER(x,LEN(x)=10))
Since your excel version doesn't support TOCOL() and some other formulas you can use this simple solution:
=IF(LEN(A2)=10,A2,IF(LEN(B2)=10,B2,""))
Put it in C2 and drag id down for a result:
Since you didn't specify what to do if both columns has 10 digit number or both doesn't, in those cases it will return first 10 digit number or empty string.

What is the most optimal way to use ArrayFormula() to Count non-Blanks Where Column Header Matches Row Value?

What I'm attempting to do is count the number of blank cells across a dataset where the header of the row matches an array.
=countifs(D1:AZ,D2:AZ,D1:1,A2)
However, it appears that since the array sizes are different, it can't use it as a lookup.
Ideally, I'd be able to get an array formula to count the number of non-blank cells that correspond to each date in A2:A, like this:
Looking at the documentation for COUNTIFS, I don't see anything about it not being able to handle vertical and horizontal matching.
Also, I need to avoid using =query(), since there may be instances in D1:1 where a date is missing. I will be handling that with an iferror().
Any help/advice you all could provide would be greatly appreciated!
I have made an editable copy of the dataset here for reference.
Thanks
Try this. It is a matrix multiplication formula that sums up the nonblank cells for each column. It should work for you.
=arrayformula(mmult(transpose(if(D1:1="",0,if(isblank(D2:BG),0,1))),sign(ROW(D2:BG))))
I can explain it if you are interested.
EDIT: How about this? It adds a vlookup.
=arrayformula(iferror(vlookup(A2:A,{transpose(D1:1),mmult(transpose(if(D1:1="",0,if(isblank(D2:BF),0,1))),sign(ROW(D2:BF)))},2,false)))
This may be a way to do it, on B2:
=COUNTIFS(OFFSET($D$2:$D,,MATCH(A2,$D$1:$AZ$1,0)-1),">0")
Then you auto fill down, the idea is:
MATCH(A2,$D$1:$AZ$1,0) Will match each date on column A to the date on row 1 and return an index (from 1 to N).
OFFSET($D$2:$D,,N) Will take the range D2:D and offset N columns (In this case the output of MATCH).
Finally COUNTIFS will look for >0 values in the column which header matches the date on the left.
I hope it helps

Using the 'Match' function in Excel to return a cell address

I have a list of numbers in a table that I would like to search for and bring back the cell reference of where that number resides. For example the data looks like:
A B C D
1 1 2 3 4
ok it doesn't come out very well as the first one is the row number and then each number below sits under each letter, so C1 would contain '3'....
If I wanted to return the reference number of C1 in a cell I am using the formula of =CELL("address",MATCH(AU14,C1:AG1)) but this just errors. I have tried to put an Index in there too, but I believe that index only works vertically so this bring back a #N/A result.
Can anyone assist as I've wasted too much time on this already! :)
You are indeed missing an INDEX. And INDEX works vertically, horizontally, or both depending on how it's called.
Here is a formula that works for the ranges in the pictures. Should be easy to modify.
Formula in C5
=CELL("address",INDEX(B2:F2,MATCH(C4,B2:F2,0)))
formula
results
To make CELL work you need a cell reference, e.g.
CELL("address",C1)
The trouble is that MATCH just gives you a number, not a cell reference.
Probably the easiest way is to use the ADDRESS function, so a first try might be
=ADDRESS(1,MATCH(AU14,C1:AG1,0)+2)
That would give you the right answer if AU14 contained 3, but isn't considered to be very good because it wouldn't update if you deleted/inserted rows or columns.
A better one would be
=ADDRESS(ROW(C1),MATCH(AU14,C1:AG1,0)+COLUMN(C1)-1)
Then you might want to put in some error handling for the case where it's not found
=IFERROR(ADDRESS(ROW(C1),MATCH(AU14,C1:AG1,0)+COLUMN(C1)-1),"Not found")

Finding position of result

I have a worksheet looking at football results. I have inserted a formula to discover the longest sequence of blank cells which indicates to me how many games between either wins/draws/defeats. Taking wins as an example which I have in Column H, this formula (The cells in Column H contain either a 1 or are blank)
{=MAX(FREQUENCY(IF(H1:H5077="", ROW(H1:H5077)), IF(H1:H5077=1, ROW(H1:H5077))))}
has told me that the longest sequence without a win for the selected team was 19 matches. That formula and result on my workbook is in cell H5094
What I want to do is discover where amongst 5000+ matches that sequence is?
I've tried this formula which I've used before in an adjacent column and copied down
=IF(COUNTIF(OFFSET(H2,0,0,$H$5094,1),1)=$H$5094,"here","")
however it hasn't worked. I think the mistake is within the formula, possibly the 0 and 1 but I don't know how to put it right, I've tried several variations.
Any help much appreciated.
The method looks fine to me, but the easiest way would be to use COUNTBLANK instead of COUNTIF, so the formula would be:-
=IF(COUNTBLANK(OFFSET(H2,0,0,$H$5094,1))=$H$5094,"here","")
or alternatively
=IF(COUNTIF(OFFSET(H2,0,0,$H$5094,1),"")=$H$5094,"here","")
I noticed that you could get some extra 'heres' if the longest sequence came at the end of the range, but you could fix it by putting a '1' in H5078.

Format the last cell only with value equal or higher than X

How do I use conditional formatting to format only the last cell in each column with a minimum value ?
This implies a non-VBA solution.
I have tried using this formula, but it stops after first match (5 is formatted):
AND(A2>=5,COUNTIF($A$2:A2,">=5")=1)
Using this data, only 9 should be formatted.
Data:
1
2
3
4
5 <-- actual result
6
7
8
9 <-- expected result
UPDATE:
This formula seems to do the trick, but only works when the cell values in the range are numeric, which mine are, and only in 1 column. Range must match format area.
Note: I found the "INDEX..E+307" part somewhere else, but lost the URL so cant give credit.
AND(A2>=5,A2=INDEX($A$2:A10,MATCH(9.99999999999999E+307,$A$2:A10)))
A multi-column supported formula is now needed. Using OFFSET might be the way to go..
I'm reading the problem as this:
We want to highlight the last cell in the column, but only when the cells in that column contain at least one sufficiently large value.
Assuming data starts in A1, I came up with this:
=AND(COUNTIF(OFFSET(A$1,,,COUNT(A:A),1),">=5")>0,ROW()=COUNT(A:A))
There are some assumptions there: like we can say that the number of non-empty values can be counted by COUNTA(), or that data starts in row 1 so that we can find the last row with ROW()=COUNT(A:A). But hopefully you get the idea...
If you are in fact looking for the greatest value, not the last one, then this be a starting point:
AND(A2>=5,A2=MAX($A$2:A10))
That should work to locate the highest value across multiple columns as well. If your table can grow over time then you should look at defining the range with an OFFSET() formula.

Resources