=INDEX(Sheet17!$B$2:$B$50,MATCH(C5,Sheet17!$A$2:$A$50,0))
Short version:
This formula works when C5 is an exact match for text in Sheet 17 Column A, but I want to be able to match part of c5 (a keyword or phrase in C5) to that keyword or phrase in Sheet 17 Column A.
Details:
For my home budget and expense tracking, I'm using INDEX and MATCH to
return a piece of text (a label I use for the expenditure) from Sheet17 Column B
based on matching C5 (the description in my check register)
to a keyword or phrase in Column A Sheet17!$A$2:$A$50
AND IT WORKS when the text in C5 (in this case) is an exact match for the text in the column to look up against Sheet17!$A$2:$A$50
But I want to be able to match PART of C5 to Sheet 17 Column A and return the result
I've tried using wildcards around C5 but that doesn't help.
This works for exact matches between C5 and a keyword or phrase in Sheet 17 Col. A
=INDEX(Sheet17!$B$2:$B$50,MATCH(C5,Sheet17!$A$2:$A$50,0))
When I put wildcards around C5 such as ""&C5&""
I get the error message "Did not find value (the full text of C5) in the MATCH evaluation.
=INDEX(Sheet17!$B$2:$B$50, MATCH(FILTER(Sheet17!$A$2:$A$50,
SEARCH("*"&C5&"*", Sheet17!$A$2:$A$50)), Sheet17!$A$2:$A$50, 0))
_______________________________________________________________
=ARRAYFORMULA(IFERROR(VLOOKUP(REGEXEXTRACT(C3:C,
TEXTJOIN("|", 1, Sheet17!A2:A)), Sheet17!A:B, 2, 0)))
demo spreadsheet
Related
Example of my google sheet spreadsheet cells below
1
AAA C1
BBB C4
AAA C7
A1: "AAA C1"
B1: "BBB C4"
C1: "AAA C7"
I would need to maximize the highest numbers after the letter "C" from all the strings that start with "AAA". I have only reached to maximize all numbers after "C" by using the formula:
=Max(ARRAYFORMULA(VALUE(REGEXREPLACE(a1:c1,"[^[:digit:]]", ""))))
Nevertheless, with the above formula I have not been able to select only the strings that start with "AAA". I have tried the function =maxifs, but it does not allow string functions such as MID being applied to the range of cells.
This is my first question here, I hope it is all clear and someone can help me with this problem.
Thanks!
Suggested Solution #1:
=Max(ARRAYFORMULA(VALUE(REGEXREPLACE(FILTER(A1:C1,ISNUMBER(SEARCH("AAA",A1:C1))),"[^[:digit:]]", ""))))
I left your original formula essentially as it was, since you already understand it as it was. All I did was replace your range with a FILTER of that range.
The FILTER alone — FILTER(A1:C1,ISNUMBER(SEARCH("AAA",A1:C1))) — keeps only those entries in the range where searching for "AAA" results in a position number (i.e., all matches for "AAA" as anything else would result in an error).
If the "AAA" must appear first in the string, you can use this version:
=Max(ARRAYFORMULA(VALUE(REGEXREPLACE(FILTER(A1:C1,SEARCH("AAA",A1:C1)=1),"[^[:digit:]]", ""))))
Suggested Solution #2:
=Max(ARRAYFORMULA(IFERROR(VALUE(REGEXEXTRACT(A1:C1,"^AAA.+(\d+)$")),-9^9)))
This will find the max from REGEXEXTRACTs matching only the "AAA" cells. If something doesn't match the "AAA" pattern, the IFERROR will return an incredibly high negative number (which will rule those out from ever being the MAX).
I think you just need to alter your REGEX expression.
^A{3}[^A].*?C(?=\d+)
^A{3}[^A] : start with exactly three uppercase A
.*?C : find the First uppercase C
(?=\d+) : the C follow by at least one number.
which will extract the part you want to replace with empty string.
e.g. AAA C1 will extract AAA C which after replace will leave you only 1.
try:
=MAX(INDEX(1*IFNA(REGEXEXTRACT(A1:C1; "^AAA.+(\d+)"))))
You mention:
...maximize the highest numbers after the letter "C" from all the strings that start with "AAA".
The mentioned answers work for a single row.
If you want to apply it to any range of rows in more complex situations you can use
=MAX(INDEX(IFERROR(
REGEXEXTRACT(FLATTEN(A1:C),"^AAA .*C(\d+)")+0)))
I am using Excel 2016 and have text in another language in column A (currently French but could be another in another spreadsheet) and I want to put a formula in e.g. cell B1 which will translate cell A1 and show the result in B1. I then want to drag the formula down (if possible) so then this formula translates each cell in column and puts the result in the corresponding cell in column B e.g. B2 will have the translation in English for A2 and B3 will have the translation for A3 and so on...
Is this possible?
To answer your question:
"Yes"
...it is definitely possible.
I have to create a macro which will:
Get the value from the cell A1 search this value in column C.
If the value in cell A1 exists in column C, the macro needs to be compare the value in cell B1 with values in column D.
If the value in cell A1 exists in column C AND the value in cell B1 exists in column D, then the text "Values found" should appear in cell E1.
The above needs to happen for all non empty rows in column A.
I was trying to use the following formula:
=IF(ISERROR(MATCH(A2,$C$2:$C$138,0)),"Load number not found","Load number found")
But it not working as I want. I have limited access to internet so I can't check all web sites. Would you please help me. Thanks a lot.
To check if A1 is in column C and if B1 is in column D (in the same row A1 was found in column C), then you need to do the following:
=IF(ISERROR(MATCH(A1,$C:$C,0)),"Load number not found",IF(B1=INDEX($D:$D,MATCH(A1,$C:$C,0),1),"Load number found","Load number not found"))
The first IF checks if A1 is in column C, the second IF checks if B1 is in column D (in the same row A1 was found in column C)
It will return "Load number found" only if both conditions are true. Otherwise it will return "Load number not found".
You can write a macro to do the same thing. But the easier way is to lock the cells in column E only and protect the sheet so that users will not accidentally change any of the formulas.
Update:
Since Column C can have duplicates, need to use the following array formula:
=IF(ISERROR(MATCH(1,(A1=$C:$C)*(B1=$D:$D),0)),"Load number not found","Load number found")
When you paste this formula to E1, make sure to press CTRL + Shift + Enter instead of just pressing the Enter key.
If I understand, a conventional solution with formulae is to concatenate your C and D column data and then search that. If you insert a new columnC with:
=D2&E2
copied down to suit you could apply (but say in ColumnF rather than ColumnE) your existing formula with only slight modification:
=IF(ISERROR(MATCH(A1&B1,$C$2:$C$138,0)),"Load number not found","Load number found")
subject to quite what is in which row.
I have two sheets in an excel workbook. One of the sheets has 8 ID numbers. The other sheet has about 5000 rows, not every row matches one of the ID numbers on the other sheet. I want to flag the rows where an ID number is an exact match to the other sheet and extract them to a separate sheet.
At the moment I was thinking I could just type in
=IF(A2=sheet2!b3,1,0) OR IF(A2=sheet2!b4,2,0) OR IF(A2=sheet2!b5,3,0) OR IF(A2=sheet2!b6,4,0) OR IF(A2=sheet2!b7,5,0) OR IF(A2=sheet2!b8,6,0) OR IF(A2=sheet2!b9,7,0) OR IF(A2=sheet2!b10,8,0)
Then copy and paste them to a separate sheet, but this doesn't work for some reason.
Any help would be much appreciated.
I didn't fix your formula for all the 8 ID's, but you should be able to add additional checks.
=IF(A2=$B$3;1; IF(A2=$B$4;2; IF(A2=$B$5;3;0)))
This basically reads as:
compare A2 with B3, if they match return 1 (note the use of $ sign in order to always use the B3 cell, this is called absolute cell reference)
if it doesn't match then compare A2 with B4 and if that matches return 2
if it doesn't match then compare A2 with B5 and if that matches return 3
if it doesn't match return 0
If you wish to compare to all 8 IDs you should just nest the if's a bit more.
A simpler solution would be to use VLOOKUP.
Here is a example of the sheets, in which I am trying to create a macro with vba.
In the first sheet, there is a value for NAME in D3, which is 25, it can change but number only.
In second sheet, there is table. Where b1,b2, b3, b4 till b13, are name(variable) values from 1 to 13(As in sheet d3, different value). In A1 to a13, there is serial no. from 1 to 13.
In third sheet, there is table.
Where b1,b2, b3, b4 till b13, are name(variale) values from 14 to 26(As in sheet d3, different value). In A1 to a13, there is serial no. from 1 to 13.
So, I want that the macro should check for sheet 1 d3 value in all worksheet, if found it will check for the serial no. against it, put the no. in E6 filed.
Sorry of I've misunderstood your question but it sounds like a vlookup might do the trick rather than the need to write VBA and use the Find method.
If you combine the second and third sheet, so that Column A contains the possible values for NAME in D3, and the Serial Number in Column B, like this.
NAME | Serial
-----|-------
1 | qwerty
2 | bob
... | ...
You can then use a LOOKUP query as follows in E6.
=VLOOKUP($D$6,Sheet2!A:B,2,FALSE)
Hope this helps.