If statement changing when it's not supposed to - excel

I have the formula below. The overall goal of the formula is to compare dates and tell me how far ahead or behind we are based upon the end date. Column C is for "projected dates" and column D is for "actual dates". So, use the projected until we know the actuals, then switch to the actuals once they're known.
What the formula is supposed to say (basically) is: "If D7 (actual end date) is blank, then subtract the projected dates in C4 from C7, but if D7 is not blank (i.e., filled in with an actual date), then subtract the actual dates in D4 from D7".
The problem is, as soon as you fill in a date in D4 (not D7, as the formula says), the cell where the formula is changes. Which I don't understand, because the formula is saying "If D7 is blank, then do this..." not "when D4 is not blank, do this..."
In other words, it shouldn't do anything until D7 is filled in, but it changes when D4 is filled in.
What am I missing?
=IF(D7="",((($K$14-$K$11)/(100/($C$7-$C$4)))*100)*-1,((($K$14-$K$11)/(100/($D$7-$D$4)))*100)*-1)

Related

In excel 365 how to subtract values sequentially but skip empty cells

Not sure how to word this exactly. We have a spreadsheet to keep track of pump runtimes.
We want to subtract the run times in column B and output to Column C so for instance B4-B5 would output .3 to C4. I don't have a problem with basic formula =B4-B5 in C4 and so on down the column. However when I get to B8 I want B7 to subtract B10 and skip the B8 and B9. The reason is that the 25th and 26th was a weekend so values weren't recorded. (these sheets are printed, recorded on location and then brought back to the plant at the end of the month) so what if possible would be a formula I can use?
after using the formula this is what happens:
enter image description here
Try the following formula in C4 and drag down
=IF(B4<>0,B4-INDEX(B5:$B$33,MATCH(TRUE,B5:$B$33<>0,0)),0)
It's checking the cells below for the first non-zero and returning the difference to that value. The key principle here is in the range B5:$B$33. The dollar signs ensure that when you drag the formula down the end of the range you're checking stays at B33, whereas B5 will become B6, B7, etc.
If the column B entries are stricly non-increasing, as per your example, in C4:
=IF(B4,B4-XLOOKUP(9^9,B5:B$33,B5:B$33,B4,-1),0)
and copied down.

Using the most recent cell in a formula in Excel

I want to have a formula that substracts the last cell in a column.
Example:
I fill in a value in the B column every now and then. B2 is the starting value. In C2 I want this formula to show the difference between the starting value and the most recent value. So if I fill in a value in B5 today, the formula should be
=B2-B5
But if I fill in B6 tomorrow, it should automatically change to
=B2-B6
With what formula can I do this?
You can try:
=B2-INDEX(B:B,MATCH(9.99E+307,B:B))
=$B$2-LOOKUP(2,1/ISNUMBER($B:$B),$B:$B)

date formula to return blank if cell is empty

I have the following formula in cell R3. =If(Isblank(E3),"",(E3)+365. This formula gives me the date I am looking for if I have a date entered in cell E3. However cell E3 does not always have a date in it. When there is no date in cell E3 I get #Value in cell R3. Is there a way to leave R3 blank if no date entered in E3.
How about:
=IF(E3="","",E3+365)
Alternately you could wrap your entire formula within an IFERROR() function:
=IFERROR(IF(ISBLANK(E3), "", E3+365), "")
The advantage of this (or disadvantage depending on which way you look at it) is that it will also mitigate any other errors you might encounter from incorrect data types being placed into cell E3, such as #DIV/0, etc.

Combine if else and vlookup into one statement

I'd like to ask how can I use if and else to my calculation in Excel. Here's the case:
A1=usd, B1=php, C1=conversion amount in usd, D1=total amount in usd
Question: The formula will place in cell d1. I want this way, if I put amount into cell a1 it will only lookup the amount and displayed in cell d1 or if I'm going to put amount in cell b1 and c1, cell d1 calculates the conversion of cell b1 and c1 (a1/c1)? Can you provide me formula or code?
Try
=IFERROR(IF(A2<>"",A2,B2/C2),"")
You can modify the conversion as per your wish.
Note: It will calculate conversion only if the A2 cell is blank or else it will display the value of A2.
Let me know if it works.

Copy a Value from a row to another row based on a condition

Friends i need a excel formal, struggling for some thing like this form past few days :(
it should search for the value in which starts with `01` in `B row`
and past that value in `A1,A2,A3,A4.......` till it got another value in `B row`
which stars with `01`.
in my table B1 will start with 01 for 100%
so after B1 if B27 has a value starting with 01, this formal should copy the B1 value from A1 to A26
from A27 it should past the value of B27 (from A27 to some other cell in B row which starts with 01 )
Your English could be better ^^;
Anyway, if I understand well, it seems to me that a simple IF() would suit you.
In A2, put:
=IF(LEFT(B2,2)="01",B2,A1)
In A1, just put the value of B1 yourself since the formula can't reference to cell A0.
Then just drag down the formula.

Resources