Excel - Split characters - excel

I want to split the characters of a cell into columns.
For example if cell A1 is the number 5678, then I want to transform it to B1=5, B2=6, B3=7, B4=8.
How can I do this? I tried with =MID($A1, COLUMNS($A$1:A$1), 1)
However this split the characters into different cells in a row.
I do not mind if it will be done by formula or VBA.

B1: =MID($A1,COLUMNS($A:A),1)
and fill right
In your original post, you indicated you wanted to split the value into columns. If you want to split it into separate rows, then, change columns to rows:
B1: =MID($A$1,ROWS($1:1),1)
and fill down.

Related

Comparing every odd and even rows in excel

I have a very long column of strings in an excel file. I want to compare every odd and even row together. i.e to compare cells A1 and A2, then A3 and A4, then A5 and A6, etc. I do not want to split it into two separate worksheets, one containing odd number rows and the other one containing even row numbers.
Any help on this, please?
You can use the formula below. You start at row 2. Check if it is an even row then compare it with the above odd row
=IF(MOD(ROW(), 2)=0,A1=A2,"")
Update as requirement from comments, firstly, you have to insert the blank row for the formula to get value B1:
=IF(MOD(ROW(), 2)=0,A2=A3,B1)

Excel array formula to find duplicate row across multiple columns

is there a way to indicate duplicate rows across multiple columns using an array formula?
Data:
AA1 BB1 CC2 duplicate
AA1 BB2 CC1
AA1 BB1 CC2 duplicate
AA1 BB1 CC1
In the above table, rows 1 and 3 are the ones I need to indicate, by putting "duplicate" in column 4.
I know of the remove duplicates functionality in Excel, but I have to see the duplicate lines before actually deleting them. Also, adding a hidden helper column is not an option because of what happens with the file further down in the process...
If data was just in one column, a countif formula would work. So I was hoping some sort of countif(col1 & col2 & col3, range(A:A & B:B & C;C)) could do the trick...
Thanks!
You have to understand what does a duplicate mean. It means if there is occurrence of any more occurrences of the original value. In you example, the first row is NOT a duplicate because it does not have any occurrences before. The next value is a duplicate because it has a second occurrence. I have prepared for you a method to extract out duplicates and mark them as need.
Formula in cell D1:
=CONCATENATE(A1,B1,C1)
Formula in cell E1:
=COUNTIF( D$1:D1, D1 )
Formula in cell F1:
=IF(E1>1,"Duplicate","")
--Edit:
If you want to show all duplicates(including the original value)
Formula in cell D1:
=CONCATENATE(A1,B1,C1)
Formula in cell E1:
=IF(COUNTIF($D$1:$D$4,D1)=1,0,1)
Formula in cell F1:
=IF(E1>0,"Duplicate","")
Cheers!
It;s not necessary here for array formula COUNTIFS will do the job.
=COUNTIFS($A$1:$A$4,A1,$B$1:$B$4,B1,$C$1:$C$4,C1)
To your point where removing the duplicate lines is the objective, not deleting all rows including the first occurrence, and a helper column is not an option, here is how to achieve it.
Using a slightly different formula from Adirmola's answer:
At column D, observe how the addresses are locked... e.g. A$1:A1... for formula at row 1. As you fill down the formula, the left part row number stays the same, but the right part row number increases. Therefore counting the instance of the duplicate occurence.
Then if adding a helper column is not an option, lets bring in the conditional formatting for the purpose of highlighting those 2nd, 3rd, 4th.. occurence, filter by color, and delete them.
Here is how, you will first select the region where the duplicates occur. The active cell (cell in white instead of grayed of the selected region) must be at the first row of the selection.
Add a conditional formatting, using the same formula in column D above for row 1, but this time, lock all the columns, and put a condition >1 behind.
Apply the condition, and you can go ahead and filter by color and delete the duplicates!
Additional info: COUNTIF and COUNTIFS is a very inefficient formula for very large data (about 10,000 rows above depending on how many columns involved). You may feel slow Excel response so it might be a good idea to delete the formula away after removing the duplicate rows. Otherwise, add a double quote to disable the formula so that it can be reused next time. ="COUNTIFS($A$1:$A1,$A1,$B$1:$B1,$B1,$C$1:$C1,$C1) > 1"
Hope this helps

Excel 2016: adding number values in a row from cells with text and numbers

I need to add number values in a row where cells contain text and numbers; like "P1" or "S7" where I need to add the 1 and 7 into a total column.
I can extract the number values from individual cells using =RIGHT(V3,SEARCH("P",V3))+0, but can't figure out how to do that easily for row of 32 cells.
Example:
For example to sum D1 through G1, use:
=SUMPRODUCT(--MID(D1:G1,2,9999))
As you see, this formula discards the lead text character in each cell.
EDIT#1:
To add cells beginning with P or S only, use:
=SUMPRODUCT(--MID(D1:G1,2,9999)*(LEFT(D1:G1,1)="P")) + SUMPRODUCT(--MID(D1:G1,2,9999)*(LEFT(D1:G1,1)="S"))
You can place your formula on the first column of your row. Then when you copy the formula across your columns it will automatically reference the cell offset the same as V3 is offset from each other cell with formula.

Excel get cells value if cells contain specific text

I have Table 1 & 2 like image.
How i can get all cells value if ID is equals?
If you just need to add numbers, there are formulas for this, but I'm not sure if there's a single formula for adding string values as in the provided example. One way to resolve this is by using accumulator columns as in this screen shot:
The formula in cell C3 is:
=IF($A3<>C$1,C2,IF(C2=0,$B3,C2&", "&$B3))
Copy this down to cell E10 (or wherever that table needs to end) and columns C to E will accumulate the values from column B. Table 2 then just maps the first and last rows of the accumulator columns. The zeros in cells C2 to E2 is a work-around to prevent Excel from converting blank cells into zeros.
Hope this helps!

Excel - how to split cell with delimiter

i want to split the value of the excel cell in two values, but still have them only in one cell. I mean: i have cells with for example 40/50. Many of them. I want to count sum of numbers in front of / and the second sum of numbers behind /. Is it somehow possible without splitting those numbers in two different columns?
thx
If all your cells in range A1:A4 are in format x/y,
to sum all x use: =SUM(1*LEFT(A1:A4,FIND("/",A1:A4)-1))
to sum all y use: =SUM(1*RIGHT(A1:A4,LEN(A1:A4)-FIND("/",A1:A4)))
both formulas are array formulas, so you should press CTRL+SHIFT+ENTER to evaluate them.

Resources