How to Copy/Paste a value from 1 cell to 2nd Cell using a 3rd Cell which holds the address of the 2nd Cell. I want to trigger the copy/past action by a 4th Cell going 'true'. I do not want to use VB as I am not competent with it.
You will need to use VBA I think. The only way to get a cell to show a value other than by programming is to enter a formula into your 2nd cell - but by definition you don't know what that is. Assume that A1 holds the value to copy, A3 is the cell holding the cell address and A4 is the true/false cell. Then you need this code in the module page of the sheet you wish to affect:
Private Sub Worksheet_Calculate()
If range("a4") then
range(range("a3").text).value = range("a1").value
End If
End Sub
Note this will error if A3 doesn't hold a valid cell address
This might be too easy for many but i need an help.
I have following formula in Sheet1 which takes the value from Sheet2 M3 Cell
='Sheet2'!M3
M3 cell in Sheet2 has a formula inside which is following:
=INT(NETWORKDAYS(K3;L3)/5)+1
I want to paste the formula inside M3 to my formula in Sheet1 but when i do this as following i get an error.
='Sheet2'!INT(NETWORKDAYS(K3;L3)/5)+1
Can anyone tell me what is wrong here and how i can paste this formula correctly so it works?
Your question was a bit confuse, but:
Do you want the NETWORKDAYS formula to get data from Sheet1 itself?
If yes, just erase the 'Sheet2'! part of your formula.
2. Do you want the NETWORKDAYS formula to get data from Sheet2?
If yes, this is the final formula:
=INT(NETWORKDAYS('Sheet2'!K3;'Sheet2'!L3)/5)+1
The problem is that you should use Sheet reference ('Sheet2'!) before cells, not before formula, so that Excel knows where it should get the data.
say we have:
Sheet1 cell A1 contains the formula:='Sheet2'!M3Sheet2 cell M3 contains the formula:=INT(NETWORKDAYS(K3;L3)/5)+1Select the A1 cell and run this short macro:
Sub FormulaGrabber()
Dim s As String, r As Range
With ActiveCell
s = .Formula
Set r = Range(s)
s = r.Formula
.Formula = s
End With
End Sub
The macro will go to Sheet2, grab the formula in M3 and put it back in Sheet1
I am working with a list of data where one or multiple cells in a row can be blank.
Lets say the list is cells A1, A2, A3, A4. I am trying to create a function that will do the following:
IF A1 has a value I want the cell to return A1.
IF A1 is empty then I want it to return A2.
IF A1 and A2 are both empty I want it to return A3.
If A1, A2 and A3 are all empty I want it to return A4.
first result on google: http://chandoo.org/wp/2014/01/15/find-first-non-blank-item-in-a-list-excel-formulas/
This formula returns the first TEXT cell for a range B1:B100:
=VLOOKUP("*", B1:B100, 1,FALSE)
* is a wild card in Excel. When you ask VLOOKUP to find *, it finds the first cell that contains anything.
NOTE: This approach finds first cell that contains any TEXT. So if the first non-blank cell is a number (or date, % or Boolean value), the formula shows next cell that contains text.
If you need to find non-blank that url gives the following solution:
If you want to find first non-blank value, whether it is text or number, then you can use below array formula.
=INDEX(B1:B100, MATCH(FALSE, ISBLANK(B1:B100), 0))
Make sure you press CTRL+Shift+Enter after typing this formula.
How this formula works?
ISBLANK(B1:B100) portion: This gives us list of TRUE / FALSE values depending on the 98 cells in B1:B100 are blank or not. It looks like this:
{TRUE;TRUE;TRUE;FALSE;FALSE;FALSE;FALSE; ...}
MATCH(FALSE, ISBLANK(…), 0) portion: Once we have the TRUE / FALSE values, we just need to find the first FALSE value (ie, first non-blank cell). That is what this MATCH function does. It finds an exact match of FALSE value in the list.
INDEX(B1:B100, MATCH(…)) portion: Once we know which cell is the first non-blank cell, we need its value. That is what INDEX does.
As indicated in your comment on your question, you have 500 rows interspersed with blank cells. You want to fill blank cells with the value of the last non blank cell.
I'd write some VBA code that'd work as follows: select the range of cells you want to back fill and run this VBA:
Sub fillBlanks()
For Each c In Selection.Cells
If c.Value <> "" Then
lastVal = c.Value
Else
c.Value = lastVal
End If
Next c
End Sub
basically, if the cell is empty, use the value of the last non blank cell (if there were no blank cells above, it will remain blank). Else, if the cell is not empty, save this as the last non blank cell. Repeat for every cell in the selected range.
Step by Step instructions on using this vba code - for this sample worksheet:
Make sure the range is selected, press ALT+F11.
This should open the Visual Basic Editor:
Press F7, This should bring up the code for the activesheet. Paste the VB code from above:
Press F5 (or use the menu to run the code).
The end result should be as follows:
Select ColumnA:
HOME > Editing > Find & Select > Go To Special... > Blanks, OK, =, ↓, Ctrl+Enter.
You can just put a rank.eq formula in the column next to it, and do a vlookup to bring all of your data to the top. This will bring all of your data to the top.
For example, in the image below I am ranking using the percentage, I want to bring the cells with data to the top for presentation, I will hide all columns other than where my vlookups are.
This did the trick for me
=LOOKUP(2,1/(A1:A13<>""),A1:A13)
Source credit: here
For example, there is some value in cell B1 of my worksheet, and cell C1 is empty (there's no value in it). I would like excel to populate cell C1 with the value in cell B1 if C1 is empty. If cell C1 is not empty (i.e. there's some value in it), then I would like Excel to do nothing. The same goes for D1 and E1... if they are empty, I would like Excel to populate them with the value in cel B1; if not, then do nothing. Can you please show me how to do this? Thanks for your help.
You can make use of VBA
Firstly you need to use Worksheet_Change or Workbook_Sheetchange to keep track of changes.
Get the value of the Cell C1 and B1
If C1.value = NULL, then C1.value = B1.value
You need to write the code by yourself.
I am new creating macros and I usually record them but I'm having problems copying and paste as values to remove the formula from 3 highlighted cells
For example I have a formula on cell B3 C3 & H3 so I would like to highlight only those cells manually and then the macro can remove the formula on each like copy and paste as values on the same cells
I have tried with ActiveCell.Select but that only works for 1 cell not for multiple cells and also the problem is that I need to change to values different cells each day
Not sure I follow your question exactly but here is what I think your asking for.
You can loop through each cell that is selected and then set the cell value to it's current value which effectively removes all formulas. There are other ways to do this but I think this best answers your specific question.
Sub removeFormula()
For Each cell In Selection
cell.Value = cell.Value
Next cell
End Sub