I need help.
I have a thousand rows in 1 column. Each rows either end with a digit or a letter. And this letter ranges from A until RR. How can I select all the values that end with digit only?
Your help is much appreciated. Please respect my post.
I tried to used "not ending with" option in Filter. But i can only have 2. Is there a way to range the filter values from A through RR?
Assuming the input data is in column A, I consider the entire column, but you can adjust it to your specific range, then you can use:
=FILTER(A:A, ISNUMBER(-RIGHT(A:A,1)))
It returns the rows from column A that ends with a single digit. We use the minus sign (-)to convert a text into a number. If it is not a number returns #VALUE! and in that case ISNUMBER returns FALSE, otherwise it returns TRUE.
If your Excel version doesn't support FILTER function, the following answer to the question: What is an alternative of FILTER function for other than office365 excel? provided by #P.b can be adapted to your case as follows:
=IFERROR(INDEX(A:A,SMALL(IF(ISNUMBER(-RIGHT(A:A,1)),ROW(A:A)),
ROWS($1:1))),"")
Then just expand it down.
Please take into account that using the entire column is not efficient, better to adapt it to your specific range. Using a specific range for example A1:A3. The previous formula can be modified to return the entire array, there is no need to expand it down:
=IFERROR(INDEX(A1:A3,SMALL(IF(ISNUMBER(-RIGHT(A1:A3,1)),ROW(A1:A3)),
ROW(A1:A3))),"")
Related
We use this format in our casino to know where we have to send our employees to certain tables or games. We recently changed the way we do this and we now need to have some checks to make sure we didn't forget certain tables.
Every hour/half hour/20mins we assign a table to a person, everyone else moves one up. We know exactly which tables are open at which times. We fill this in at the top. When we fill in the upcoming timeslot we would like to have some check so we don't forget a table and maybe miss out a employee.
Example:
In the example supplied you can see that we accidentally have two number 6's but no 7 I highlighted the number 7 in the top row but it would be nice if this is doable automatically
I used VLOOKUP and INDEX/MATCH in the formula for Conditional formatting but that does not seem to create the correct outcome.
Here is an example of how it can be done:
The formula used has the array {1;2;3;4;5;6;7} hard written into it, assuming that the number of tables does not vary. The output is 0 when no table is missing, otherwise it returns a list of missing tables separated by commas.
Note: That of course means, the comma separated list is not a numeric value but a string value and cannot be used for further calculations. If further calculations on this output are required, the 'solution' has to be changed accordingly.
Formula
=IFERROR(CONCAT(FILTER({1;2;3;4;5;6;7},ISERROR(MATCH({1;2;3;4;5;6;7},H5:H24,0)))&", "),0)
Explanation
The MATCH() function checks which of the numbers 1 to 7 are present in the given range (here H5:H24) and returns the cell index of where it is found. When a number does not appear in the range, the MATCH() function will generate an #N/A error for that number.
Then, the ISERROR() function will output a FALSE value for all numbers found by MATCH() and a TRUE value for those numbers where the MATCH() function lead to an error.
The FILTER() function filters and thereby reduces the number array {1;2;3;4;5;6;7} to only those numbers where the ISERROR() function is TRUE.
The CONCAT() function concatenates the resulting array from the FILTER() function (in case more than 1 number is missing) to a single string of numbers separated by commas.
However, when there are no open tables, i.e. the MATCH() function finds all numbers 1 to 7 in the given range, then the ISERROR() function will only return FALSE values and the thus the FILTER() function returns an 'empty' array, which is not allowed in excel and leads to an #CALC error in excel. This case is captured by the IFERROR() function encapsulating the whole calculation, and instead of showing the error, returning 0.
What about this formula:
=AND(COUNTIF(A$2:A$10,1)=1,COUNTIF(A$2:A$10,2)=1,COUNTIF(A$2:A$10,3)=1,COUNTIF(A$2:A$10,4)=1,COUNTIF(A$2:A$10,5)=1,COUNTIF(A$2:A$10,6)=1,COUNTIF(A$2:A$10,7)=1)
A bit clearer:
=AND(COUNTIF(A$2:A$10,1)=1,
COUNTIF(A$2:A$10,2)=1,
COUNTIF(A$2:A$10,3)=1,
COUNTIF(A$2:A$10,4)=1,
COUNTIF(A$2:A$10,5)=1,
COUNTIF(A$2:A$10,6)=1,
COUNTIF(A$2:A$10,7)=1)
... which means that the number of ones need to be 1, the number of twos need to be 1, ..., up to the number of sevens.
Hereby a screenshot of an Excel sheet, which contains that formula:
In order to understand how this works, you might work with formula auditing, more especially formula evaluating, hereby an extra screenshot, showing formula evaluating after some steps:
Have fun :-)
Worksheet 1 contains a list of names and quantities that are updated daily below (i.e. AAA is a name and 1 is the quantity):
Name
look.AAA :1
look.BBB :2
look.CCC :3
I'm trying to get the table in Worksheet 2 to search for text within the column range and extract the quantities using formulas.
So far i've tried search, lookup, vlookup, find & match functions (and combinations of these) but everything produces errors. I've tried to see if someone else has done something similar but I could not find anything online:
=match(aaa,sheet1!A2:A4)
I'm expecting to retrieve the quantity number by searching for the name and finding it within the text of a cell range.
You are on the right track. There are several ways to do this. VLOOKUP, LOOKUP, and a combination INDEX/MATCH are some of the more common methods. Since you started with match, this solution will carry on with your methodology.
Match is going to tell you which row of the selected range you are looking for. What you need to do is return the value from the same row but in a difference column. For starters we just need to tweak you match formula. Since you are looking for a string (text), and are hard coding it, the text value should be in quotes. Your Match formula becomes:
MATCH("AAA",sheet1!A2:A4,0)
That zero at the end tells match you are looking for an exact match. The other possible values for 0 are 1 and -1, but you need to have a sorted list and they will do an approximate match going forward or in reverse respectively. For a reverse search the list needs to be sorted in reverse order.
Now that you have a formula for the correct row within the selected range, you can use that in an INDEX formula from a matching size range somewhere else in the workbook. In this case you have it in the adjacent column. Your ultimate formula becomes:
INDEX(Sheet1!B2:B4,MATCH("AAA",sheet1!A2:A4,0))
Alternative options
VLOOKUP
VLOOKUP("AAA",sheet1!A2:B4,2,0)
See below revised solution:
I have given a name "Look_Rng" to the list which contains the original data.
My logic is to use a combination of MID, LEN and FIND functions to extract a number range and a text range from the original range first:
Number Range: {=--MID(Look_Rng,FIND(":",Look_Rng)+1,LEN(Look_Rng)-FIND(":",Look_Rng))}
which will return {1;20;300;3;2}
Text Range: {=MID(Look_Rng,MIN(IFERROR(FIND(D2,Look_Rng),33000)),LEN(D2))}
which will return {"AA";"oo";"CC";"e.";"lo"}
Then use MATCH function to find the position of the given name in the Text Range. For instance, if you are looking for CC in the Text Range, it will return 3.
Lastly, use INDEX function to locate the value in the corresponding position in the Number Range. For instance, CC is in the 3rd place in the Text Range, so its corresponding position in the Number Range is 300.
The full formula is quite long, and you MUST press Ctrl+Shift+Enter when exiting the formula to make it work because it is an ARRAY FORMULA.
{=INDEX(--MID(Look_Rng,FIND(":",Look_Rng)+1,LEN(Look_Rng)-FIND(":",Look_Rng)),MATCH(D2,MID(Look_Rng,MIN(IFERROR(FIND(D2,Look_Rng),33000)),LEN(D2)),0))}
Let me know if you have further questions.
P.s. I agree with #ForwardEd that it would be much easier if you use a couple helper columns to break the original data down and use simple INDEX+MATCH or VLOOKUP to look for the value. My answer used the same logic anyway.
I have around 30 numbers which are either 1, 2 or 3 digits which are codes. These codes are attached in front of other numbers. I want to know what code is in front of a number, for example for the number 35467036 the first two digits matches with the code 35. So I want the output for that to be 1.5.
This is my current setup, I have a table with all the codes followed by the output in the next column. If all the codes were three digits long I could just do this =VLOOKUP((LEFT(E6,3)&"*"),D1:E3,2,FALSE) but they are unfortunately not.
I have also tried using nested IF statements but I can only go so far as 7 levels.
Will this only be possible in VBS or is there anther way?
Edit:
The code column is formatted to text. If I enter the value 3 into LEFT it does not work for two digits. Is there anyway I can make it work for 1, 2 and 3 digit codes? Also the codes do not overlap, for example, there isn't going to be 96 and 965 in the code table.
Seven nested IFs as a limit points to a very old version of Excel. You may want to consider upgrading to a version that is still supported in this millennium.
But your main problem is that the data type of your lookup value is text, because you concatenate a string with a wildcard. Whereas your Lookup Table's first column is probably made up of numbers.
In order to solve this you will need to add a Text column to your lookup table that represents the numeric value as a text value.
IF you want to use Vlookup, that helper column will need to be the first column of your lookup range.
You can use an Index/Match instead of Vlookup to be independent of the column order, as this screenshot shows:
Column H shows the formula that has been applied in column G.
Edit:
According to the screenshot you posted, you want to look up from the table in columns E to F and this table only has the short codes. Therefore, it makes no sense to add a wildcard to the lookup value. You just need to extract the value you want to use for the lookup.
If you want to lookup only two digits, then you need to extract only two digits. Adding a wildcard does nothing to remove the third digit.
In the screenshot below, a helper column feeds the LEFT() function the number of characters to extract, then uses that value in the VLookup.
=VLOOKUP(LEFT(A1,B1),$E$1:$F$5,2,FALSE)
=INDEX($G$2:$G$5,
SMALL(
IF(LEFT(A1,3)*1=$F$2:$F$5,ROW($G$2:$G$5)-1,
IF(LEFT(A1,2)*1=$F$2:$F$5,ROW($G$2:$G$5)-1,
IF(LEFT(A1,1)*1=$F$2:$F$5,ROW($G$2:$G$5)-1))),1))
=INDEX(LookupValues,Small(ArrayOfRowsFromIfStatements,FirstRow))
This is an array formula so you will need to use Ctrl+Shift+Enter while still in the formula bar.
We use If to build an array of Row numbers where the conditions match or return FALSE if not. The Small function then returns the smallest result in the array which will be the first row where conditions match.
We then index the results returning that row number (-1 deducted from rows to offset the headers).
If your numbers in column A are always 6 digits + the code length you can use this:
=VLOOKUP(--LEFT(A1,LEN(A1)-6),E2:F5,2,FALSE)
The vlookup function appears to be broken. It is returning the same value for all lookups, but it should not.
I have it set like so:
=VLOOKUP(A3, Asset_Mapping!A$2:B$673, 1)
Where the lookup value is in the B column and the result is in the A column.
I use the $ so the rows are not auto-updated to A3:B674 etc as I paste the formula down the rows. However, even if I manually enter that formula into the next row, it is not finding the correct value.
IF i remove the "$", the correct values are found for the first rows where the values fall within the modified range (e.g. Asset_Mapping!A3:B674) but eventually as expected it stops finding the values as the range is invalid.
What am I doing incorrectly here? I have formulas set to auto-calculate.
Without testing on your actual data it's hard to confirm this will work but add the false parameter. This will find exact matches and not the first partial match.
=VLOOKUP(A3, Asset_Mapping!A$2:B$673, 1, false)
Collating the points together and clarifying the formula
Parameter 1: The value you are looking for
Parameter 2: The table with the data. First column is the value you are looking for.
Parameter 3: The column number of the value you want to show.
Parameter 4: If you want an exact match or partial match.
#Jeeped made the point of ordering data to get more reliable results. Good advice.
Andres has the right idea, but there is a faster way to fix the problem.
If it is returning the same value over and over again for your whole range, you probably have your Calculation Options set to "Manual".
Go into Formulas on the top ribbon and choose Calculation Options. There, you can change your calc method to "Automatic".
Also lookup value must be in first column.
Where the lookup value is in the B column and the result is in the A column.
VLOOKUP always lookup in the left-most column and returns a value from the column number specified. If you want to reverse the lookup/return order then use INDEX(..., MATCH(...))
=INDEX(Asset_Mapping!A$2:A$673, MATCH(A3, Asset_Mapping!B$2:B$673, 0))
Note that you were using a sorted, binary lookup; I've changed this to an exact match lookup which does not require sorted data.
Just in case adding a solution to this topic.
Don't know why in big tables Vlookup and Index+Match tend to show just the value of the first result in all the other cells.
In my case to fix this, after I've copied the formula in the whole range, I choose any cell containing it, press F2 and then Enter. It kind of forces excel to process everything.
I've been working on this for a week with no results. I've created this same spreadsheet for another apartment community without any issues, but for some reason, I cannot get the proper results in this spreadsheet. I've tried vlookup as well, but that didn't help either. any more advice?
Formula
Result and lookup vectors
I record the value of my stocks each day in columns and it is a long spreadsheet. In the top cell of each column, I want to use a function that will display the last entry in the column automatically. I've tried the Index function and the Index function combined with the Counta function with no success. Any suggestions?
Try using LOOKUP, assuming at most 1000 rows of data (adjust as required) use this formula in A1 to get the last number in A2:A1000
=LOOKUP(9.99E+307,A2:A1000)
You can have blanks or any other data in the range (even errors) and it will still return the last number
Try this for Column A, resp. Cell A1:
=OFFSET(A$2;ROWS(A$2:A$101)-COUNTBLANK(A$2:A$101)-1;0)
This example is for a maximum of 100 rows of data (2 - 101). You may replace 101 by any higher number according to the size of your sheet.
Please note that there may be no blank cells in the middle of the list.
The answer Jens Fischer provided worked excellently and also translated well to google sheets whereas other solutions have not. I made one small change; by using A$1 as the reference I didn't need the -1 at the end of the formula.