I need to subtract the minimum of that column from all rows of the column in Excel. I have one million rows and I cannot drag the right corner of the cell box all the way down to apply the formula to all those cells. I unfortunately haven't found anything that works. I want to subtract the minimum of a column from each cell of that column divide by 1000 and store in another column:
=(B1-MIN(B:B))/1000
How do I apply this to all rows of the column where I want this to work?
How do we apply formulas in general to all rows of a column in general?
Several ways to apply a formula to a new column in a large data set:
Option 1 - turn the data into a table: Assuming the data has headers, select the data and hit Ctrl-T or use Insert > table and tick the box "My table has headers". Now enter a name for the new calculated column and below the header enter the formula. It will automatically be applied to all rows in the table.
Option 2 - Enter the formula in the first row of next empty column of the data range. Then double click the fill handle (the lower right-hand corner of the selected cell) to fill the formula all the way down to the last row of the data range
Option 3 - Select the cells where the new formula should go. Easiest might be to start at the bottom end of the data and use Ctrl-Shift-up arrow to select up to the top. Adjust the selection to suit and hit Enter or Shift-Enter to make the top cell the current cell. Enter the formula and confirm it with Ctrl-Enter. It will be applied to all selected cells.
Copy the column, say it's A. In a couple of spare cells enter:
=MIN(A:A)
and
1000
Copy the formula cell, Paste Special..., Values over the top. Copy that cell, select the copy of ColumnA, Paste Special..., Operation Subtract. Copy the cell containing 1000, select the copied column, Paste Special..., Operation Divide. Filter ColumnA to select blanks and delete the contents on the copied column for the selected rows.
Related
I have about 100,000 lines of data in Excel and some coloured cells in column C which I want repeatedly to populate in column B up until the coloured cell contains different text, when I want to populate that different text, etc. Example below:-
Before:
http://i61.tinypic.com/24q758n.png
After:
http://i59.tinypic.com/t6as9l.png
Are there any macros, VB scripts or "IF" statements I could use? It seems like a life time's work if done via copy 'n paste.
Filter to select the coloured cells, say in ColumnB. In ColumnA insert =Bx where x is the row number of the first row that has been coloured (repeat for other colours if necessary). Then select ColumnA, Copy, Paste Special, Values over the top and then select from Ax to end, HOME > Editing -Find & Select, Go To Special..., check Blanks, =, Up, Ctrl+Enter.
Select column C and choose Data ► Sort & Filter ► Autofilter. Use the filter pull-down in C1 to Filter by color.
In B2 put in the formula =C2 and fill down to the extents of your data.
Click Data ► Sort & Filter ► Autofilter to remove the filter.
First select B2 to the bottom of the data then tap F5, click Special and choose Blanks then click OK.
B3 should be the active cell. Type =B2 and finalize the formula with Ctrl+Enter. This will populate all of the blank cells with a relative copy of that formula.
Your column B should be populated as you described. Optionally use Copy then Paste Special, Values to revert the formulas to their results. Optionally color column B to be same as C2.
I am trying to do the following via a formula rather than VBA/macro (i do not want a copy/paste special solution as i need more control). is it possible to:
I have a column in which there are some blank rows and some rows with values. let's call that column A. In column b, i only want to copy the cells if the column A has a value. if it doesn't, i want it to skip to the next cell in column A, but stay on on the same cell for column b.
Column A
1
2
[blank]
4
[blank]
6
i want column b output to be (but with no blank rows). this would imply that somehow the formula would need to loop and have some loop skipping logic:
1
2
4
6
Normally i would just set cell B1 = A1 to copy it over, but since i want to skip rows that are blank in column A, i'm not sure what to do besides right a macro. Can i use an array or any other creative solution? Eventually, i would also use this for items with specific values (not just blanks).
thanks!
Generically in cell C2 copied down....
=IFERROR(INDEX(Range,SMALL(IF(Range=criteria,ROW(Range)-MIN(ROW(Range))+1),ROWS(C$2:C2))),"")
confirmed with CTRL+SHIFT+ENTER
so here if your data is in A1:A10 and you want results from B1 down
=IFERROR(INDEX(A$1:A$10,SMALL(IF(A$1:A$10<>"",ROW(A$1:A$10)-ROW(A$1)+1),ROWS(B$1:B1))),"")
confirmed with CTRL+SHIFT+ENTER and copied down
when you run out of data you get blanks
For BLANKS, just copy ColumnA to ColumnB, select ColumnB, Find & Select, Go To Special..., Blanks, right-click one of the selected cells, Delete... with Shift cells up.
If you don't care about the ordering of the numbers (such as an array that will be binned or analyzed with a histogram), then simply copy the row and paste values only in another row. Now just sort the row of values. It will place all the empty cells at the bottom of the selection.
I have two tabs - the ALL tab and CATA tab.
ALL tab has all the data (source)
CATA tab is the target tab where specific rows have to be pasted.
Question:
I want to search all rows one by one,
then copy rows from source tab where the column I has CATA word in it
and then paste that row to the target tab.
Sample data for column I:
"USTA;#CATA;#INTA;#Non-TA"
"USTA;#INTA;#Non-TA"
I would suggest using an approach as described below:
Insert a filter on the whole table, and filter on column I on Text > Contains and type "CATA" in the entry box.
Copy everything except column A then paste in the tab CATA.
If the number of rows that match is unknown and you don't want blank rows in between, this will produce a subset of the rows that contain the phrase "CATA" in Column A.
This is the formula for cell A2 that can be dragged down as far as needed:
=IFERROR(
INDEX(ALL!A:A,
SMALL(
IF(
NOT(ISERROR(FIND("CATA",ALL!A:A))),
ROW(ALL!A:A)),
ROW()-ROW($A$1))),"")
It must be entered with CTRL+SHIFT+ENTER.
It will display a blank row once all the possible CATA rows have been found.
For Column B, it changes only by two references (A:A becomes B:B):
=IFERROR(
INDEX(ALL!B:B,
SMALL(
IF(
NOT(ISERROR(FIND("CATA",ALL!A:A))),
ROW(ALL!B:B)),
ROW()-ROW($A$1))),"")
You may replicate this for as many columns as need to be transferred. Don't forget to start entering it in Row 2, and be sure to enter the first one with CTRL+SHIFT+ENTER before dragging it down the column.
Put simply, I need to sort row data for a specific range into the correct columns based on that columns heading. For example, if there are five columns labelled A through E, and data in the rows below ranging from A through E; I need all of the A's to be in the A column, all of the B's in the B column etc.
Example start data:
How it should look after the sort:
It also must be able to work with the possibility of having empty cells. For example; if the first example data had no B in row 3, the data must not shift over to the left so that C is in the B column etc.
Other info: not feasible to do by hand - over 450 rows.
It also must be able to work with the possibility of having empty cells.
Taking the above into consideration.
NON VBA WAY
Insert enough columns so that the data moves to the right
Next in the row one, duplicate the values from your data
Next in Cell A2 Put this formula
=IF(COUNTIF($H$2:$L$2,A1)>0,A1,"")
Copy the formula to the right
Next remove "$" from the table range and add it to the header in formula in Cell A2 so that we can copy the formula down. This is how it would look
=IF(COUNTIF(H2:L2,$A$1)>0,$A$1,"")
Similarly your B2 formula will look like this
=IF(COUNTIF(H2:L2,$B$1)>0,$B$1,"")
Change it for the rest
How highlight cells A2:E2 and copy the formula down.
Your final Sorted Data looks like this.
Copy columns A:E and do a paste special values on Col A:E itself so that the formulas change into values and then delete Cols H:L
I have an excel sheet which looks like this:
I want to insert row(or cell) below every filled cell. Like this:
I have thousands of records so need to do this automatically. How can I achieve this?
Thanks in advance!
A non-VBA approach would be to make a new sheet, and enter this formula in A1:
=INDEX(Sheet1!A:A, ROUNDUP(ROW(A1)/2, 0))
Then select A1 and A2 (leaving A2 blank), copy it, select twice the number of rows as in Sheet1, and paste.
If you only want values, you could then select column A and copy, then paste special and paste values only.
You could do it in VBA with the following code:
Sub doIt()
Dim numRows As Long
Dim i As Long
numRows = ActiveSheet.UsedRange.Rows.Count
For i = numRows To 2 Step -1
ActiveSheet.Rows(i).Insert Shift:=xlDown
Next i
End Sub
select the raw that contains the data you want to separate by 1 cell at a time.
press F5.
click special.
at the Go to Special dialog box, click "Constant".
right click 1 of the selected cell and insert
Alternatively, I found the following solution from https://www.pcmag.com/article/149833/insert-alternate-blank-rows-in-excel
You can create the blank rows separately and then interleave them with the existing rows by sorting. To start, insert a new column to the left of the existing column A. Enter 1 in cell A1 and highlight column A all the way to the last row that contains data. From the Edit menu select Fill | Series and click on OK. Column A should now contain numbers from 1 to the total number of rows. Press Ctrl-C to copy these cells to the clipboard, click in the cell just below the last of them, and press Ctrl-V to paste. Now highlight the entire data area, including the new rows with just a number in column A. Select Sort from the Data menu and choose the No header row option in the resulting dialog box. Under Sort by select Column A, under Then by select column B, and click on OK. Finally, delete column A. You now have a blank row after every one of the original 1,000-odd rows.
Because blank lines can often cause problems with charts or calculations, you may want a quick way to remove them. You can use a similar technique.
Again, insert a new column to the left of column A and fill a series from 1 to the end of the data. Highlight the entire data area and sort by column B (the first column of real data). This will group all of the blank rows together. Next, highlight the data area again, and re-sort by column A. The blank lines are gone, and your data is restored to its original order. Finally, remove column A.
easy way:
in a free column (example is column A) fill the first 3 rows with 2,4,6
auto fill the column down to the end of your data.
At the end, fill the next 3 lines with 1,3,5
Autofill down the same amount of lines your data is
now select all, data-> sort-> A
wich will sort your data to 1, (empty) 2 (data) 3 () empty
;)