Auto fill in the blanks in Excel [duplicate] - excel

This question already has answers here:
Copy cell from a coloumn if value is starting with #excel #formula [duplicate]
(2 answers)
Closed 7 years ago.
I have 3 columns of data in Excel spreadsheet, column 1 is Business Unit, column 2 is item_ID and column 3 is Cost. Column 2 and 3 have data in all rows but column 1 only shows business unit once then the rest are blank until the business changes. I can just drag the business unit data and control down to the blank ones for EACH business unit, but what if I have thousands of rows and more than hundreds of business unit? That will take me forever to do. Is there a way to do this task faster?

Let's assume the data below:
Step 1: select from cell A2 to A31 (all the data rows under Unit column)
Step 2: Click on home tab and click Find & Select.
Step 3: Select Go to Special.
Step 4: Select Blanks and hit ok.
Step 5: On the first cell, enter =A2 (equals to the cell above the blank) then hit ctl+enter

Assuming that Column A is your Business Unit column, adding a temporary column next to it and replicating the first value ie B2=A2 then on B3you could use the following formula:
=IF(A3="",B2,A3)
Copy it down to all your rows in Column B. After verifying its accurateness you could copy and paste as value into your column A and then delete Column B. Regards

Warning: Kludge
In Column 4 create a formula that says "If column 1 is blank, make it look like the row above it, otherwise do nothing"
Highlight that cell and hit Ctrl-End, which should take you to the bottom row of your spreadsheet and Shift-Click. This should highlight the entire column.
Hit Ctrl-D, to fill down. You have now copied your formula to all cells in the column.
Click the column 4 header and then copy (Ctrl-C).
Click on the column 1 header and then 'Paste Special' (Ctrl-Shift-V) and then select "Values"

In D1
=A1
In D2
=if(A2="",D1,A2)
Drag down
Copy D1 to D end of data
Click on A1
Paste as values
Delete column D

Related

Combining data in excel

Dears,
I have 4 columns in excel.
Each row have two values but also it is mapped to another row.
I'd like to sum the values from these the rows that are mapped and delete the extra rows.
Example attached: Row A has two values but also mapped to Row C. I want to add the values in Row A with the ones in Row C and keep Row A and delete Row C
Is it possible to use formulas instead of VBA as I don't have experience in VBA?
Please advise.
Assuming your Keyword data starts with A2 and Value 1 starts with B2 and Value 2 starts with C2. (Please refer the snap below)
Apply the below formula in H2 for Value 1 summing and drag down
=IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,2,FALSE),VLOOKUP(G2,$A$2:$D$4,2,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,2,FALSE))
Apply the below formula in I2 for Value 2 summing and drag down
=IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,3,FALSE),VLOOKUP(G2,$A$2:$D$4,3,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,3,FALSE))
EDIT #1 If G value does not contain in Table 1 then apply the below formula
in H2
=IF(ISERROR(IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,2,FALSE),VLOOKUP(G2,$A$2:$D$4,2,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,2,FALSE))),"Not Found in Table",IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,2,FALSE),VLOOKUP(G2,$A$2:$D$4,2,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,2,FALSE)))
in I2
=IF(ISERROR(IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,3,FALSE),VLOOKUP(G2,$A$2:$D$4,3,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,3,FALSE))),"Not Found in Table",IF(VLOOKUP(G2,$A$2:$D$4,4,FALSE)=0,VLOOKUP(G2,$A$2:$D$4,3,FALSE),VLOOKUP(G2,$A$2:$D$4,3,FALSE)+VLOOKUP(VLOOKUP(G2,$A$2:$D$4,4,FALSE),$A$2:$D$4,3,FALSE)))

How to apply formula to a whole column?

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.

excel how to paste formula from column to row

I want copy the column A formula into row 1 like this :
A B C D
1 ='sheet1'!B2.......='sheet1'!B3............='sheet1'!B4............='sheet1'!B5
2 ='sheet1'!B3
3 ='sheet1'!B4
4 ='sheet1'!B5
5 ='sheet1'!B6
but when I copy the formula from column A to B, the cell(B1) will become ='sheet1'!C3, are there any way transpose the formula without change one by one?
When you right-click (to paste your copied selection), it comes up with a Paste Special option. Click this and select Transpose. This should do it for you.
And changing the B3 (in your formula) to $B3 should stop it changing the formula

Excel - logic for skipping rows in a formula

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.

Fill non-contiguous blank cells with the value from the cell above the first blank [duplicate]

This question already has an answer here:
Fill non-contiguous blank cells with the value from the cell above the first blank
(1 answer)
Closed 8 years ago.
I want to know if there is a way to do this conditional in excel or open office:
if the cell is empty then
the cell will have the same value as the cell above it
else
do nothing.
Should I use a macro for this?
Please help me out; I have very little experience with Excel.
c 1 | 10/21/2011
c 2 |
c 3 |
c 4 | 10/24/2011
c 5 |
c 6 |
c 7 | 10/25/2011
c 8 |
c 9 |
c10| 10/26/2011
Select the range that contains blank cells you need to fill.
Click Home > Find & Select > Go To Special…, and a Go To Special dialog box will appear, then check Blanks option.
Click OK, and all of the blank cells have been selected. Then input the formula “=B2” into active cell B3 without changing the selection. This cell reference can be changed as you need.
Press Ctrl + Enter, Excel will copy the respective formula to all blank cells.
At this point, the filled contents are formulas, and we need to convert the formals to values. Then select the whole range, right-click to choose Copy, and then press Ctrl + Alt + V to active the Paste Special… dialog box. And select Values option from Paste, and select None option from Operation.
Then click OK. And all of the formulas have been converted to values.
In Excel:
If you have a table that someone has merged cells on or if you are copying a table from an html site where there can be many inconsistnacies in the copied data such as empty rows that really should have the same value as the previous row an easy way to fix this is go to an empty column and create the formula that follows.
This assumes that you have a header in A1 and A2 contains the first data and a valid row value.
If only every other cell is empty you can do the following:
= if(A2="",A1,A2)
The above function checks if A2 is blank, if it IS, it assigns the value of A1, if it is NOT, it assigns the value of A2.
However, if there are multiple empty rows that need to be filled it is better to do the following:
(assume cell whose value you want to duplicate in all subsequent empty cells begins at A2, you are willing to set the first two cells in the following column manually, column I:I is first empty column in your table)
Step One: In cells I2 and I3 ensure the proper vales are present for the associated rows.
Step Two: In cell I4 enter the following formula:
= if(A4="",if(A3<>"",A3,I3),A4)
The above function checks if A4 is blank, if it IS, it checks if A3 is NOT blank, if it indeed is NOT, it assigns the value of A3, if it too is blank, it assigns the value in I3, finally, if A4 was NOT blank, it assigns the value of A4.
You will have to drag the formula down manually (since there are empty rows).
Any empty row that follows data that you don't want should be easily identifiable by sorting the column by a key field.
As indicated by Robert above you are dealing with formula values so you can't just move them around, overwriting their source cells, but if you do a "special" paste you can paste the values directly over your source cells.
This is what I once wrote:
Sub FillInBlankCellsInColumns()
'Go down and when you find an empty cell, put the value from the previous cell in there.
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Dim MyCounter As Long
MyCounter = 0
For Each r In Selection
On Error Resume Next
If r.Value = "" Then
r.Value = r.Offset(-1, 0).Value
End If
Next
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
Debra Dalgleish provides both the
manual SpecialCells Method (that Excellll refers to)
the VBA SpecialCells method which seems to be more your area of focs
at her site under Excel Data Entry -- Fill Blank Cells in Excel Column
Alternatively, you could use the following formula in a new column:
D2: =IF(ISBLANK(C2),D1,C2)
Create a new column next to C.
Previous column D will now be named
column E. Your data is in column C, the new data is temporarily
created in column D.
The first value from C1 must be copied manually
to D1
Then in D2 you put this formula. Copy the formula all the way
down.
Then copy column D and use Paste-Special Values Only to
paste the results of column D over the existing data in column C.
Now you can remove column D
This is a little more "work" but since you state that you are not experienced in Excel, writing a macro could be challenging.
Regards,
Robert Ilbrink
use Vlookup
=+VLOOKUP("Output",D1:G7,1)
Replace D1 with the address of the starting cell to lookup
Replace G7 with the address of the Ending cell to lookup
Replace 1 with the column you want the value to be returned from
Apple 1 Apple
2 Apple
7 Apple
Mango 3 Mango
=====================
col1 Col2 Formula

Resources