Copying and pasting cells with formulas in them - excel-formula

I just used a substitute formula to remove spaces from a set of cells, I did this in column D, using data from column C, when I try to move the new data from D to C it does a substitute formula for column B?
Does anyone know how to prevent this?

You're pasting a formula, you need to paste values

Related

How to copie and paste only non blank cells

I got this case, i need to copy the Col A to Col B, but I need to paste only the value that have a value in the Col B, like in the pictures
Is there any way in excel or vba that do this?
Thanks
You can do this in VBA, but it's probably much simpler to do in the Excel UI with a formula and the fill handle. For example, if Column C is your "New B" column, then you could try using the following formula in Column C to do what you're looking to do: =IF(NOT(ISBLANK(B1)),C1=A1). Then just use the fill handle to drag the formula down as needed.
Note that this formula will do nothing if the conditional evaluates to false, i.e., if the cell is blank.
You can see more in the documentation here.

Excel formulas to work on cells with prefix

I am trying to figure out quite a simple solution to make excel either include cells with prefix in the formula or split the cell into two and use the number in the formula.
SC16 1.00--1.00--1.00--1.00
SC17 *2.0--3.00--4.00-*5
SC18 2.00--3.00--4.00--5.00
SC19 2.00-*3 *4--5.00--0.00
SC20 *2.0--3.00--4.00--5.00
sc16-20 =SUM(B1:B5) =SUM(C1:C5) =SUM(D1:D5) =SUM(E1:E5)
formulas in the picture
How can I make this work?
Solution 1: cleanse the data into a new column and sum on it
Copy the following formula in a new column for converting all values to numbers (let's say you paste it in F1, and then you drag it up to F5)
=IF(ISNUMBER(B1); B1; NUMBERVALUE(REPLACE(B1;1;1;"")))
Sum the cells in that new column (i.e. with the formula below in F6)
=SUM(F1:F5)
Thus, the column F will contain the cleansed values for column B.
BONUS: After that, you can even drag F1-F6 cells to the right, in order to get the same for C, D and E columns.
Solution 2: Split into two columns (one with the asterisks if any, and the other one with the numbers only)
Same as above + paste the formula below in the column that will contain the asterisks if any
=IF(ISNUMBER(B1); ""; MID(B1; 1; 1))

Formula to copy Column A to Column B without blanks and sorted?

I have the following column, A
C
R
H
Z
T
I would like a formula that automatically copies the data from A to B so that the data has no empty elements and it is sorted.
Column B should then look like:
C
H
R
T
Z
After that, if I were to add an element such as F to column A, such as:
C
R
H
Z
F
T
Column A would automatically update as:
C
F
H
R
T
Z
How can this be done with formulas (non-VBA code)? I'd like it to happen automatically (meaning i don't have to keep going to filter, sort every time a new piece of data is added to column A)
Thanks
You will need to create a helper column, with this array formula:
=SUMPRODUCT(IFERROR(CODE(UPPER(MID(A1,ROW(INDIRECT("1:"& MAX(LEN($A$1:$A$9)))),1))),10)*100^(MAX(LEN($A$1:$A$9))-ROW(INDIRECT("1:"& MAX(LEN($A$1:$A$9))))))
Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when exiting edit mode. IF done correctly then Excel will put {} around the formula.
Then you would use this formula to sort and filter:
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($B$1:$B$9)/((AGGREGATE(15,6,$B$1:$B$9/($A$1:$A$9<>""),ROW(1:1))=$B$1:$B$9)*($A$1:$A$9<>"")),1)),"")
One note, this may implode with large strings.
You can use this array formula and drag it down, A1 your first Data in column A, in B1 write helper column to sort values:
=IF(COUNTIF($A$1:$A$21,"<="&A1)>0,COUNTIF($A$1:$A$21,"<="&A1),999999999)
and drag it down
In C1 write =IF(INDEX(A:A,MATCH(SMALL(IF(B:B<>0,B:B,999999999),ROW(A1)),B:B,0))=0,"",INDEX(A:A,MATCH(SMALL(IF(B:B<>0,B:B,999999999),ROW(A1)),B:B,0)))
Press Ctrl+ Shift+Enter at the same time
IF will check for non empty cells and return the corresponding row
Small will find the upper non empty cell and move with the row,in row1 Small(,1)
in row10 small(,10)
INDEX(A:A) is your initial column
IFERROR in case the cells in A are empty it will return "" empty in column B
You have to drag the formula down even if you have empty cells in A, in that case when you write in the cells the formula will autofill in column B
9999999 it will not affect the small function
Without helper column you will need to sort the Data or use it unsorted but remove blank
You can use in B1:
=IFERROR(INDEX(A:A,SMALL(IF(A:A<>"",ROW(A:A),999999999),ROW(A1))),"")
Also array formula
Press Ctrl+ Shift+Enter at the same time
and drag it down
Another idea assuming your column contains only single characters,
Formula in column B,
=IFERROR(CODE(A:A),"")
Formula in column C,
=IFERROR(CHAR(SMALL(B:B,ROW())),"")
When you enter the formula you should not be doing it cell by cell or by dragging it. Select the entire column, paste the formula in formula box and press CTRL + ENTER. This will apply the formula for all cells in that column.

Copy duplicate rows from 2 columns Excel VBA

I have a worksheet with 3 columns (A,B,C).
I want to check for duplicates between column A and C
If a cell value in A matches a cell value in C then I want to copy B in that row to another location (let's say column E).
The cells are located in different rows on columns A and C.
The copy from B column needs to be on the same row as the duplicate on A, not on C.
How can I do this with Excel VBA?
Thanks a lot!
Perhaps you can use a formula like:
=IF(COUNTIF(C:C,A1)>0,B1,"")
It should give you what you want. Put that in column E, and copy it down for what you need.

Excel copy cell A to cell C if cell B duplicate

I have two columns in excel with column A is a numbers and column B is a duplicate of various texts.
I need a way to copy the column A to column C if column B is duplicate?
If you are simply trying to indicate duplicates, would this work for your case (formula goes in C2)?
=IF(COUNTIF(B:B,B2)>1,A2,"")
Work on a copy, with data headers assumed to be in row 1.
Sort data by column B.
In C2, type =IF(B2=B1,A1,"")
and copy down the sheet.
Then, if there's a duplicate, it will appear in column C

Resources