How to extract specific/multiple entries from a cell? - excel

Starting from row 1 to row 2468, I have 3 entries of 16 digit numbers in odd rows in a single cell from which I want to extract the first 16 digit number and place it in a single column. In the even numbered cells, I have two 16 digit numbers and I want to extract both of them to two new columns. Thus I want to have three columns with 1st column being the entry from odd row, and next two columns being entries from the even rows. How to proceed?

You need 3 formulas. For the formulas below, the data is in column A, the "Odd" case is going in column B, the first "Even" case is in Column C, and the second "Even" case is in column D.
In column B: =IF(ISEVEN(ROW(A1)),"",LEFT(A1,16))
In column C: =IF(ISEVEN(ROW(A1)),LEFT(A1,16),"")
In column D: =IF(ISEVEN(ROW(A1)),MID(A1,17,16),"") <--this one may need tweaking, depending on how the 16 digit numbers are delimited.

Related

Excel Conditional Formula to evaluate multiple column ranges

Apologies, If the solution is already available, I have been searching for hours!
The problem I am facing is that to put conditional formula based on column ranges for e.g:
Conditions:
1) A1=0, B1=0, C1=0, D1=0 = Result Last Four columns are zero
2) A1=1, B1=0, C1=0, D1=0 = Result Last Three columns are zero
3) A1=1, B1=1, C1=0, D1=0 = Result Last Two columns are zero
4) A1=1, B1=1, C1=1, D1=0 = Result Last column is zero
5) A1=0, B1=0, C1=1, D1=0 = Result Last column is zero
6) A1=0, B1=1, C1=0, D1=0 = Result Last Two columns are zero
7) A1=0, B1=0, C1=0, D1=1 = Result Last Column is Not Empty
The catch in the above results is that the condition should consider the column zeros from right to left.
You can:
Create a named range (I will call it Sentences) to store the hardcoded sentences you want as a result. Below is an example (do not include the header in the named range):
Hardcoded sentences
Four columns are zero
Last Column is Not Empty
Three columns are zero
First two columns are zero
Three columns are zero
Two columns are zero
Two columns are zero
One column is zero
Three columns are zero
Two columns are zero
Two columns are zero
One column is zero
Last Two columns are zero
One column is zero
Last column is zero
No column is zero
Apply this array formula (to be validated using Ctrl+Shift+Enter):=INDEX(Sentences, 1+SUM(2^(COLUMNS(A1:D1)-COLUMN(A1:D1))*(A1:D1<>0)))
Explanation: the formula counts empty cells as bits (weights: 1, 2, 4, 8), adds the bits together to create and index then look into the named range the sentence at the calculated index.
Obviously, you will have to edit the values from the named range if the values I typed do not suit your need.
Edit:
You can also handle only special cases in the range and leave the general case to a more generic formula.
By special cases, I mean things like "Last column is not empty" (only applies to the last column) as opposed to "One column is zero". (applies to all columns).
You can just leave some cells of the named range empty whenever it is a general case and let the formula below do the job.
=IF(
LEN(INDEX(Sentences, 1+SUM(2^(COLUMNS(A1:D1)-COLUMN(A1:D1))*(A1:D1<>0)))) > 0,
INDEX(Sentences, 1+SUM(2^(COLUMNS(A1:D1)-COLUMN(A1:D1))*(A1:D1<>0))),
INDEX({"All columns are zero","Three columns are zero","Two columns are zero","1 column is zero"}, 1+COUNT(IF(A1:D1=0,1)))
)

Excel How to extract two digits from Column A

I have a question about Excel How Can I extract two digits from Column B if Column B is empty extract two digits from column A. I know how to extract two digit from Column B but cannot understand how to do it if column B is empty.
for example: in column B in first row we have 123456 number we extract first 2 digits to column C, but in next row in column B is empty but column A is not empty and we need to extract number from column A.
Thanks for helping!
You must check the contents of the cells and extracts the digits if not blank
C2
=IF(B2="",IF(A2="","",LEFT(A2,2)),LEFT(B2,2))
Bye
You have to use the =ISBLANK function along with an IF statement to check the specific column in B, if it is empty, take the value from A.

Excel - Comparing multiple columns to see if results are identical

I would like to compare three separate columns in an excel spreadsheet, across thousands of rows.
If any value appears in column A multiple times (say the word hello in column A rows 1 and 4, and the word bye in column A and rows 3 & 5, I would like to check the corresponding values in column B for those rows (ie rows 1&4 and 3&5).
If the values in column B for rows 1&4 are say 15 & 15, and the values for rows 3&5 are 20 & 20 , then I want to check column C.
Now we know rows 1&4 and 3&5 have the same corresponding values in column A & B, I would like to check the corresponding values in column C. If these are different then I would like to perform a specific calculation. If they are the same values in Column C, then I want to ignore these rows.
I am sorry this is very unclear, as I cannot paste an image to show what I mean. I can email you an example if it helps.
This is way beyond me and my excel skills and I do not know where to start. Any help would be appreciated. I am hoping I don't need to write a Macro.
Thanks in advance!
So, to resummarize your question as I understand it:
Column A holds string values (text). There are some duplicates here.
Column B holds number values. When a duplicate occurs in column A, the data in column B may or may not be identical as for the other duplicate entries.
Column C holds values (you did not define what type of values, but I assume these are number values). Sometimes, duplicates in column A hold the same values in column B, and also the same values in column C. In this case, we can ignore the row as all the duplicates agree. Sometimes, duplicates in column A hold different values in column B. In this case, we can also ignore the values. Finally, sometimes duplicates in column A hold the same values in column B, but different values in column C. For these specific values, we want to perform some other type of calculation (which you did not specify).
Put the following in column D, starting at row 2 (assuming a header on row 1), which is the starting point of the formula we will build.
=IFERROR(VLOOKUP(A$1:B1,A2,2,0)=B2,"")
This says: Look at column A, starting always at row 1, and going until 1 row above the current row. Check for a match of the text in the current row. If it finds a match there, pull the result from column B. Does that result match column B in the current row? If it matches it will say TRUE; if it doesnt match it will say FALSE. If there are no duplicates yet in column A it will say "".
Now add a new check - if the above formula is TRUE [ie: there is a duplicate in column A, and the result in column B matches], then we want to check the results from column C:
=IFERROR(IF(VLOOKUP(A$1:B1,A2,2,0)=B2,VLOOKUP(A$1:C1,A2,3,0)=C2,""),"")
This will now return TRUE if the values in column C match for that duplicate in column A (which is only checked if the values in column B match too). Finally, add in your "special calculation", like so:
=IFERROR(IF(VLOOKUP(A$1:B1,A2,2,0)=B2,IF(VLOOKUP(A$1:C1,A2,3,0)=C2,"",C2+1),""),"")
Where I have C2+1, this is where you will perform your special calculation. This will only be recorded by Excel if: there is a duplicate in column A, that duplicate has a matching value in column B, and that duplicate has an unmatched value in column C.

Substract last cell in row from first cell with number

I have the following Excel sheet
In column J i need the final difference between the first cell in the row and the last cell (with a number).
Numbers can appear from column C until column I. Numbers do not always start in column C and do not always end in column I, but there are never empty cells in between.
Basically i need to subtract the value in the first cell with a number from the last cell with a number. The last value in the range from C-I minus the first value in that range with the result being displayed in J.
I filled in column J manually for now, however I would like to do it with formula.
If the numbers are always ordered from smallest to largest, you could simply do this:
=MAX(C2:I2)-MIN(C2:I2)
If not, things become a bit more difficult. Here's another solution that should work for non-ordered entries:
First, add an empty column to the right of Totaal.
Second, add seven columns with the following contents:
=IF(ISBLANK(C2),M2,C2)
=IF(ISBLANK(D2),N2,D2)
...
Third, add another empty column.
Fourth, add seven columns with the following contents:
=IF(ISBLANK(C2),S2,C2)
=IF(ISBLANK(D2),T2,D2)
...
Totaal can then be calculated with
=Z2-L2

Count how many equal values in 2 columns (ignore duplicates and empty cells) in excel

I tried to search the web but no good answer came up.
I got 2 columns (not with same number of rows), that contains values.
I need to count how many times the values are equal ignoring empty cells and duplicates.
Many Thanks!
Suppose the two columns you have are A and B (with data beginning in row 2 because there are headers in row 1). You could make a third column in C with the following formula:
=A2=B2
This will return TRUE for rows where the values in column A and column B are equal to each other and FALSE for those where they are not.

Resources