I have some data in Col"K" where from i am just trying to get the left characters as i tried in Col"H" using formula.
But what i used is Left function like =Function(cell,10) that is not the correct way characters can be more than 10 or less than 10.
1st formula should be dynamic to get the left numeric values.
2nd Formula should copy and paste the same numeric values until next value comes as available in Col"I"
I tried to make it but what i can do is to create left function and do not know how to develop it dynamic.
Any help will be appreciated.
Sheet Link
https://docs.google.com/spreadsheets/d/1nJZeWDZ0EWgmWB0z17xU93fjIOFsu46EL37IJqJzZ_0/edit?usp=sharing
This formula should do the job.
[J2] =IFERROR(TRIM(LEFT(L2,FIND("-",L2)-1)),J1)
Note that it will fail if placed in row 1 and there is no dash in L1.
Use find function to get numeric characters length.
=iferror(trim(left(L3,FIND("-",L3)-1)),M2)
Here we are finding the separator "-" in your text and it gives us index number of separator.
Then picking text from start to before index number i.e., Numeric value and removing blank spaces, if any, using trim function. If we don't have number/separator in the text then showing previous cell value using iferror function. So, Make sure first row always has numeric value.
Same has implemented in the sheet you have shared
As per the latest data I have updated my answer as below , now it is checking output is numeric or not:
=IF(COUNT(FIND({0,1,2,3,4,5,6,7,8,9},J9))=0,K8,TRIM(LEFT(J9,FIND("-",J9)-1)))
Related
I am trying to build an excel formula, that will reference another column based off of the first word. The first word does not need to have an exact match, it will however, need to find words that are “very similar” to each other. If the words, are not a close match, I would need the original cell to show in the results tab (as seen below). I would need the excel formula to do the following:
Column A......….Column B (with desired info)......….Column C (results)
Upper Body...……….Upper...………………......………………......……Upper
Upper Arms...…………….....………………......………………......…… Upper
Upper Legs...…………….....………………......………………......…… Upper
Lower Legs...…………….....………………......………………......…… Lower Legs
I have tried, the VLookup with the range lookup, as “True”, however the above example will be a lot more complex, with the real data set I am using. Any help would be greatly appreciated.
You can extract first word and then use Index() and Match().
You will first need to get the first word of column A. You can do this by splitting column A by a delimiter (split after first space) or by using a formula.
Formula example: =IF(ISERR(FIND(" ",A2)),"",LEFT(A2,FIND(" ",A2)-1)) where A2 is the cell you are looking at.
When you have that value you can then use =Index(Match()) to look up value. Match allows for fuzzy matching as long as you do not set the last parameter to 0.
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)
This pictures shows my table and formula's yield
I have used following formula to extract result from a table.
Its working perfectly fine but I am hoping to level up my understanding of Excel formulas.
The trouble is that I use IF in Excel way to often.
what I wanted to know is if its possible to use a different approach, something that can work similar to if but is perhaps more sophisticated.
=IF(OR(J2="08L",J2="08R"),IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$34,0)),"LAM",IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$35:$E$35,0)),"West",IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$36:$G$36,0)),"East",IF(ISNUMBER(MATCH(LEFT(I2,3),'SID separations'!$D$37,0)),"SFD",NA())))),0)
I very much appreciate any help.
Now that there is an example, I think this is a good question. You've recognised that your formula is fairly messy and also can't be easily expanded if there are more routes.
The problem is that Excel is very good for searching for a value in a single row or column, but not as good for searching for a value in a block of data.
You can simplify this problem by creating an additional column that has each entire route in a single cell. You can do this just by concatenating values. In your example, use column H:
=B2&" "&C2&" "&D2&" "&E2&" "&F2&" "&G2
This will create a string with the entire route in a single cell. Spaces are added in between each part of the route to make sure you don't accidentally create a sequences of letters that matches part of another route. It doesn't matter if there are blank cells, there will just be some extra spaces at the end which doesn't matter. Fill this down the column to get the entire path for each route in a single cell.
Then, you can create a formula that tries to find the 3 letters anywhere in any of the full routes.
=INDEX($A$2:$A$5,MATCH("*"&left(I2,3)&"*",$H$2:$H$5,0))
This formula is basically a deconstructed vlookup. It determines where the 3 characters can be found in column H, then gives back the corresponding value from column A.
The MATCH function tries to find the left 3 characters of I2 in column H. The MATCH function normally tries to find a complete exact match (with the last parameter being equal to 0), but we can just add wildcards to the search value. The MATCH function then returns the index of the range where it was found. I.e., if it was found in the 2nd cell of the range H2:H5, it returns the number 2.
The INDEX function then just gets a value from a range based on an index. In this case, it will get the 2nd value from range A2:A5.
I have a column full of text/string values. Some of the values appear to be null, but in reality have some formatting (additional spaces) left over from the exporting program where I get the excel data. I am trying to create an array using all capitalized letter of the English alphabet to cypher through each cell in the column, looking for the instance of any of the alphabet's letters within the first letter of each cell in the specific column, and if not found, returning a completely blank value in the neighboring column. If a letter value is found, then it would return the entire value of the cell. This way I can have true blanks and will be able to sort things a bit better.
I have been trying to find a working argument to build off of but aside from the
LEFT(Cell,1)="A-Z"
I have found little that seems to be a viable workaround. Any help is appreciated! Thanks!
You will want to use the ascii value to check for A-Z. Assuming the data is in the A column you can use the formula below. ASCII value range 65=A 90=Z. The trick is the Code formula which returns the ascii numeric value. Then an if statement to check if it is between the range, If it is return the cell contents and if not return nothing. You can also use Clean() to remove any unprintable characters (that is not used in this example)
=IF(CODE(UPPER(LEFT(A1,1))) > 64, IF(CODE(UPPER(LEFT(A1,1))) < 91,A1,""))
If you look at the image below we are trying to get a formula working, so we can do the following.
In Row 6 we need to locate the last Full in the column that is the date before the current date.
So for Blandc01 we have a full in Row 6 and column UJ6. WE need to find the latest Full in that column and then put the date at the top of that column in the cell that says Last Full in this case it's B12.
If for example you look at Blanbck01, we have our last full on 04/07/2014 in column UF, so the cell B8 has that date in it from Cell UF6.
So how do we use a series of functions to determine the last Full in the respective row, find that date of the column and put this in the relevant cell on the left.
I have updated the image to include the row numbers.
Thanks to pnuts comments, it is apparent that a lookup using just "full" won't work on an unsorted list. So here is one that will
=IFERROR(LOOKUP(2,1/(C5:XD5="full"),$C$3:$XD$3),"")
You will need to change the row references to properly reflect the two vectors. The first array is the row where you are looking for "full", the second is where the dates are located.
The OP has been asking more questions in the comments section. It seems he wants to return the latest dates where either "full" or "syn.full" is seen in the particular line.
If merely looking for the substring "full" will be sufficient (in other words, if there are no other strings that contain "full" that need to be excluded, then one can use:
=IFERROR(LOOKUP(2,1/ISNUMBER(SEARCH("full",C6:XD6)),$C$3:$XD$3),"")
On the other hand, if there might be other strings containing "full" which we want to ignore (e.g. fullness), and if the dates in row 3 are in ascending order, then try the following:
=MAX(IFERROR(LOOKUP(2,1/(C6:Z6="full"),$C$3:$Z$3),0),IFERROR(LOOKUP(2,1/(C6:Z6="syn.full"),$C$3:$Z$3),0))
If you use the latter, you should format the cell to not show 0's (eg: yyyy-mm-dd;; ) or wrap the whole formula in an IF to return the null string if the result is zero.
Finding the last match is always more difficult than the first one but I think I have something that works. This is an array function so has to be entered with ctrl+shift+enter
=indirect("R3C" & max((UB6:UJ6="full")*column(UB6:UJ6)),FALSE)
A break down of the function is as follows
(UB6:UJ6="full") returns an array of 1s and 0s (1 where it evaluates true). This is then multiplied by the column number (given in numbers, not letters). Once these are multiplied together we have a list of all the columns that have the word "full"
The indirect function allows you to use R1C1 style formulas if the second variable is False so the column can be inputted directly as a number. The R3 at the beginning means the value returned with be in row 3.