I have the following 3 columns in my excel sheet. The dates in column A (DateTime) are in the same format as column N(DateTime2) :
Example of Excel matrix
The data are a lot, so I can't check it one by one. I tried to use match command in order to identify which date from column N(DateTime2) exist in column A(DateTime). I used the following command:
=MATCH(N2;$A$2:$A$5849;0)
I used autofill and as a result I got only first value as a number (which means that it exists), and the rest as N/A ..which is wrong. As you can see the value 1/1/16 3:00 exist in both columns.
I tried then to use the function VLOOKUP and I wrote the following command:
=VLOOKUP(N2;$A$2:$A$5849;1;FALSE)
I got the same outcome.. I checked one random value (1/1/16 3:00) to check if the two cells with the same value are equal using the command : =A3=N5 and I got TRUE ..which means that the two cells are matching.
What do you think? What is the problem?
First check that either both columns are numeric values formatted as dates or both columns contain text.
If you imported the data, sometimes different characters are used for Space. Try a find and replace (ctrl+H). Enter a Space character in both the "Find what:" and "Replace with:" fields.
Related
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)))
I'm downloading a set of 3 values using Microsoft Data Streamer in Microsoft Excel via a serial input.
I get a single line of 3 values when I press the print button on the device.
It appears the printed values are in this order in a single line:
3 empty spaces
number
3 empty spaces
number
4 empty spaces
number
I'm ensuring that based on cell format the values that print/upload are up to 3 decimal places.
Example:
63.140 179.655 79.870
For the first value I'm using this formula:
=LEFT($B8,SEARCH(".",$B8)+3)
For the second value I'm using this formula:
=MID($B8,10,10)
For the third value I'm using this formula:
=RIGHT($B8,SEARCH(".",$B8)+3)
I get each of the numbers listed above in a separate column.
When I try to take their average I get a #DIV/0! error.
I did convert the cell columns to numbers with 3 digits but still get the error.
I then tried to copy the values into another other cell and it says it's a text format.
Is there a way to ensure the values are numeric in the beginning or after the formula has been used?
Or can I convert the text to a number via a formula?
Are there alternate methods to separate these values without using the excel delimiter separation menu?
Thanks!
Formula sample shown to extract value
divide by zero error
In case you got Excel 2013 or highter you could try to get the average directly:
=AVERAGE(FILTERXML("<t><s>"&SUBSTITUTE(B8," ","</s><s>")&"</s></t>","//s[node()]"))
If you got Excel 2010 (which it looks like looking at these screenshots), you could try:
=((--LEFT(B8,FIND(" ",B8)))+(--TRIM(MID(SUBSTITUTE(B8," ",REPT(" ",LEN(B8))),LEN(B8)+1,LEN(B8))))+(--TRIM(RIGHT(SUBSTITUTE(B8," ",REPT(" ",LEN(B8))),LEN(B8)))))/3
I am using Excel 2007.
I found out that the formula was converting the values to a text format even though my output cell was formatted as a number cell up to 3 decimal places.
This is what worked and gave me actual numbers and an average for each row:
First Column (Cell: F8) =LEFT($B8,SEARCH(".",$B8)+3)
Second Column (Cell: G8) =MID($B8,10,10)
Third Column (Cell: H8) =RIGHT($B12,SEARCH(".",$B12)+2)
I transferred these values to another 3 columns to get actual values rather than text:
First Column (Cell: J8) =VALUE(F8)
Second Column (Cell: K8) =VALUE(G8)
Third Column (Cell: L8) =VALUE(H8)
I then took the average of these cells and confirmed the answer was correct by verifying via the calculator tool in Windows.
screenshot of results
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)
In Excel 2013 I have two tables.
The first contains alpha numeric codes that vary in length.
Some examples from first table:
12345.12345
12346-12345
12AB1234
123.123
23456.123
A1234567.012
01234.12345
The second table contains alpha numeric codes I need to match with the beginning of the codes in the first table. Any numeric codes are currently stored as text.
Some examples from second table:
12345
12346
123
23456
A1234567
01234
How do I return a value from a different column in the second table containing any value? And for some context, the return column from the second table contains a description of for the codes.
I did not jet manage to find a solution using vlookup or match.
Also looked at using wildcards, but this only works one way, the wrong way.
The quickest solution, assuming you dont care about letters, is to use a LEFT(FIND( with substitution. If letters need to be excluded, then explanation will need to be provided how the format should be presented.
Solution: =IFERROR(LEFT(A2,FIND(".",SUBSTITUTE(A2,"-","."))-1),A2)
This formula will find the first "." or "-" and present all characters prior to. If none are found, then it will display the full ID.
If letters need to be removed as well, however, it should be noted that the use of some serious substitute nesting, or VBA script will be required.
A1 is the first cell in your column, in B1 write the following:
=LEFT(A1,MATCH(TRUE,ISERROR(VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))),0)-1)
press Ctrl+Shift+Enter at the same time (Array Formula)
it will return the first numeric part of your Data
you can copy paste values in column C and compare with the second table
To have the result in Table1 directly in B1 use:
=IFERROR(INDEX(Sheet2!$A$1:$A$4,MATCH(VALUE(LEFT(A1,MATCH(TRUE,ISERROR(VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))),0)-1)),Sheet2!$A$1:$A$4,0)),"")
press Ctrl+Shift+Enter at the same time (Array Formula)
It will return the corresponding number from Table2 (sheet2) if matched or "" empty if no match
Change A1:A4 to correspond all your Numbers in Table2 and keep the $ to fix the references when you drag down the formula
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.