I need to make Total_Price calculation of working hours:
Excel sheet looks this way:
Job_name(A1);Time_spend(B1);Total_Price(C1);
And I have hour price in special constant cell - F1.
To get Total_Price I'm using formula =B1*F1. After this I copy cell and paste into all rest cells in C column manually. According this procedure C2 gets formula =B2*F2, but I need =B2*F1.
How to make this procedure more automatic?
Use absolute referencing. Instead of =B1*F1 use:
=B1*$F$1
Adding the $ signs in front of the cell references prevents the reference from changing as you drag the formula.
Related
I have a table that somewhat looks like this:
I am trying to spread the values on column B using an IF-AND function so that it would pull the values from column A until it reaches a new value in the column.
I have tried =IF(AND(A2="",A3="",A1<>""),A1,A2) for cell A2, but while the function recognizes the beginning of a new value, it ends up in 0s all in between.
How should I adjust the function to be able to fill the cells with corresponding values? I appreciate the help.
If you're willing to enter a value in B1 by hand, starting in B2 you can use:
=IF(A2="",B1,A2)
If not, and if you don't mind using a volatile* formula, starting in B1 you can use:
=IF(A1="",OFFSET(A1,-1,1),A1)
*Note: a volatile formula is one which causes an entire workbook to recalculate whenever any change is made. This can significantly slow down a workbook.
The adjusted formula is =IF(A2="",B1,A2). It basically pulls the value from above if the cell to the left is empty, and if it isn't empty, it pulls the value from the cell to the left.
The corrected formula
I am attempting to use an IF statement to check whether the sum of two cells from another Excel sheet is greater than or equal to 1.
For a sheet called Test1 with the values of interest in column C, this is what I have so far, which works fine:
=IF((Test1!C1+Test1!C2>=1),1,0)
In column B on a second sheet that I'll call Test2, I want to copy this formula down 200,000 rows. However, if the aforementioned formula is in cell B1, for the formula in B2 I would like the formula to read:
=IF((Test1!C3+Test1!C4>=1),1,0)
I want to copy the formula down the column so that the second cell reference in the formula in the first row does not become the first cell reference in the formula in the second row (eg. it would go C1+C2, then C3+C4, C5+C6, etc.).
I have tried manually entering the formula for a few rows, highlighting those, and copying them down but can't get the desired cell reference pattern. If I highlight and drag these first three formulae down another three rows, C4 and C5 are repeated and not in the correct pair.
=IF((Test1!C1+Test1!C2>=1),1,0)
=IF((Test1!C3+Test1!C4>=1),1,0)
=IF((Test1!C5+Test1!C6>=1),1,0)
=IF((Test1!C4+Test1!C5>=1),1,0)
=IF((Test1!C6+Test1!C7>=1),1,0)
=IF((Test1!C8+Test1!C9>=1),1,0)
I have tried using OFFSET() within this formula but couldn't get it to work. I am basically just wanting to add 1 to each of the cell references in the formula, as compared to the previous row (but not to actually add 1 to the value of that cell, as would happen with C1+1 for example).
Any insight would be greatly appreciated!
If you plan on copying this down 200K rows then you will want the absolute simplest formula that accomplishes the stagger. Avoid the volatile OFFSET function or be prepared to spend a lot of time waiting for random calculation cycles to complete. A volatile function will recalculate whenever anything in the workbook changes; not just when something changes that involved the formula in the cell.
=--(SUM(INDEX(Test1!C:C, (ROW(1:1)-1)*2+1), INDEX(Test1!C:C, (ROW(1:1)-1)*2+2))>=1)
The following formula should do the trick:
=(SUM(INDIRECT("C"&ROW()*2-1);INDIRECT("C"&ROW()*2))>=1)*1
And that's the version using IF:
=IF(SUM(INDIRECT("C"&ZEILE()*2-1);INDIRECT("C"&ROW()*2))>=1;1;0)
You say I am basically just wanting to add '1' to each of the cell references in the formula but appear to be incrementing by 2, so I am confused but an option might be to apply you existing formula to 400,000 rows, together with =ISODD(ROW()) in another column, then filter on that other column to select and delete those showing FALSE.
Excel's autofill won't do the 2-cell shift that you're looking for. You can use the functionality that is there.
Put =IF((Test1!C1+Test1!C2>=1),1,0) in the top cell and drag a copy to the second row (it will be =IF((Test1!C2+Test1!C3>=1),1,0) but that's okay). Now, put 'A' and 'B' in the next column. Select all 4 cells and copy them down 400k rows.
Use filter to delete rows flagged with 'B' and delete the blank rows.
(Select blank rows with [F5] click Special and select Blanks, then right-click and delete)
Here is all you need. It's fast and nonvolatile.
=--(SUM(INDEX(Test1!C:C,ROW(1:1)*2-2):INDEX(Test1!C:C,ROW(2:2)*2-2))>=1)
Copy it down as far as you like.
In Excel I want to copy a formula down and control the relative cell reference.
For example
In A1 if the formula was =B1 and I copied the A1 formula down to A3 the formula in A3 would be =B3. Is there a way of copying the formula in A1 to A3 and have it equal B2?
That's the default copying behaviour in Excel. Did you try it? In fact, if you want to disable it, you have to write $ in front of the fixed row and/or column denominator, so for example $E$1 would be fixed when copied (useful for things that remain constant).
Edit: I think I can imagine what happens: You probably tried to copy the cell contents from the formula editor field. Copy the cell instead, so just mark the cell in the grid by highlighting it, copy it, highlight your target and paste.
Edit2: And please note that you can just drag the little square at the edge of a highlighted cell to apply that cell's formula to an entire area, using the same relative referencing as with copying.
quick excel question:
If I put values in cell B1 and B2.
Then write the following formula in cell A1:
=$B$1-$B$2
then I highlight cells B1 and B2 and move them to column C. the formula in A1 automatically adjusts for the move ie. formula now becomes:
=$C$1-$C$2
How would I get it to stick to column B and not switch to column C. I tried searching google but did not get right answers (probably am not phrasing question correctly).
The context of my problem is that formulas in one sheet are being calculated based on month end data which is placed in another sheet. Now I need to add April month end data. So I shift the old data to the right and input April's data, but the formulas are automatically adjusting for the shift and still refer to March's month-end data. This despite the formulas using absolute referencing.
Thanks for any help provided
The formula you are looking for is
=INDIRECT("B1")-INDIRECT("B2")
This will always refer to Cells B1 and B2 regardless of what you to do move the cells or add new columns etc.
This will allow you to simply insert a column for the new month.
Not a good spreadsheet design, you should really add new data to a new column.
However, if you are determined to stick to that design, copy and paste the old values to a new column, then delete the originals. Formulas will not be alterd by that.
I'd like to create a sheet that has a master formula. From there, I'd like to have a number of lower cells below use the same cell formula but apply it at it's relative position.
For example, in B1 i would write = a1+1.
In b2, I'd like it to apply the b1 formula, so I'd type in a formula to link to b1, but what I really want is the code in that cell, and to have it be relative, so the output would be a2+1.
In b3, id reference b1 but have it return a3+1.
In b4, id reference b1 but have it return a4+1
In b5, id reference b1 but have it return a5+1
This is a very simplified version of what I need. the benefit of doing this is I can change the formula in B1 and have it cascade to all the cells below it. In reality, I can't just drag down because I'm using a template for financial statements on a per market basis. we have dozens of markets and its a pain in the rear to copy/paste them down each time I want to make a simple formula change.
Thanks for any comments. I'd like to do this without VBA if possible. With VBA it gets easy.
Have you considered Named Formulas? If you use relative references in named formulas, then they will be adjusted if the named formula is used in another cell.
For example: Select cell B2, click Formulas > Name Manager > New, enter a name like B2Formula and let it refer to
=Sheet1!A1+1
No $ signs in the cell reference!!!
Now enter this formula into B2:
=B2Formula
Copy the formula down.
Now you decide you need a different formula in B2. So edit the named formula and change it to
=Sheet1!A1*2
and look at the sheet! You only edited one formula, but all the values in column B have adjusted to that new formula
Named Formulas are VERY powerful, especially when used with relative references. Remember that the references will be relative to the cell that is selected when the named formula is defined. Also, when you need to change a named formula with a relative reference, you need to select the same original cell before editing the named formula.