Subtraction with blank cells - Excel - excel

I created spreadsheet for budgeting purposes and have it set up so that every time I add some data in my income or expenses column, my balance column automatically posts a readjusted value. However, my formula only seems to work for positive values (see conflict on row 4 of example) Here's what I have so far, pasted in as an array formula in B3 and copied down.
=IF((ISNUMBER(C3:D3)),B2+C3-D3,"")
How could improve the "if true" section of my formula?

the problem you're having is your if statement will return false if either C or D is not a number. if(c through d is a number) will mean that it only is true when both are numbers.
If you want to make it so that you only evaluate numbers (and not treat blanks as 0), then you'll probably want to make an OR statement:
=IF(OR(ISNUMBER(C3),ISNUMBER(D3)),B2+C3-D3,"")
Just be aware that if the relative location of B2 is missing data (if you did not have any expense or income the previous day/week/whatever), then the next field will become a value error when you add something. So if B5 is empty because you didn't do any spending or gaining, then when you spend and put value in "expense" on D6, B6 will become #Value.
To fix this, it might be a good idea to finish off not with an empty string, but with the value of the previous date. It's up to you if you want to use it that way.
=IF(OR(ISNUMBER(C3),ISNUMBER(D3)),B2+C3-D3,B2)

You could try the following, applied on B3:
=IF(AND(ISBLANK(C3),ISBLANK(D3)),"",B2+C3-D3)
This way, you don't need an array formula - I'm just checking if C3 AND D3 are blank - if so, the cell will be empty, otherwise will do the math.

You could put an Or statement in so that if either C3 or D3 is a number, then calculate accordingly.
=IF(Or(ISNUMBER(C3),ISNUMBER(D3)),B2+C3-D3,"")

Related

Excel IF statements, with 3 conditions if a=true and b=true and c=true then d1 = ""

I want to make an excel formula so that, I can test out 3 columns and if they are true then to set a new value to the 4rth column.
I have this formula:
=IF(AND(A1="ALFA ROMEO"; B1="159"; C1="55");D1="2016";D1="")
and I want to check if A1 and B1 and C1 are true then to set D1 equal to a certain value.
*I've tried many complex ways to achieve it but this formula is the only one that doesnt pop up an error, but still gives back the Value FALSE(Not in D1, but in the cell I tried it). I've also tried seperating with commas etc...
Any possible help or way I could achieve the check?
It should come from the quote ("") around the number
I've try this
=SI(ET(A1="ALFA ROMEO";B1=159;C1=55);2016;"")
and it worked for me (sorry it's in french).
Maybe try to change cell format from the column B and C.
And also put the formula in cell D1 or in the cell you want the value.
You're almost there, but you need to put this formula here in cell D1 in order to fill the value of D1:
=IF(AND(A1="ALFA ROMEO", B1=159, C1=55),2016,"")
Keep out: in my locale I'm working with commas, while you might be working with semicolons, so your actual formula might be (in cell D1):
=IF(AND(A1="ALFA ROMEO"; B1=159; C1=55);2016;"")
Also, no need to put numerical values (159, 55) as strings, as you can see.
Edit: about turning B1 into a string:
I've just created this formula:
=IF(TEXT(B1,"0")="159","TRUE","FALSE")
This allows you to convert B1 into text.
So, your formula might turn into something like:
=IF(AND(A1="ALFA ROMEO", TEXT(B1, "0")="159", TEXT(C1,"0")="55"),2016,"")
(Again, mind the locale settings (commas and semicolons))

"Dynamic" cell subtraction in a column with potential blanks

I am trying to make a table where a cell in each subsequent row subtracts from the previous one to show the change between the two. The problem is each row isn't always populated so something like A2-A3 then A3-A4, A4-A5, etc. will not work.
How can I skip blank rows in the formula to achieve a result like shown in the attached image (A6 being subtracted from A3 since A4/A5 are blank).
Thanks,
In b3,
=if(a3<>"", abs(a3 - index(a:a, match(1e99, a$1:a2))), "")
I wasn't sure how you wanted to handle the subtraction so I made the difference an absolute value.

INDEX/MATCH Returning the wrong value. What did I do wrong?

I'm trying to create an spreadsheet where INDEX/MATCH automatically populates monthly sales goals. However, it is returning the wrong number.
In cell B6 I want the value to be 10000. In columns G and H, I've set the goals and the corresponding date in the hopes of matching the goal to the date in row 2.
B6 is returning "6000" AND "7/19/2015" in an adjacent cell when it should just be returning "10000" ... and I don't know why.
In H6 the goal for the 7/12/2015 is set at 10,000 from cell G6, which corresponds to the date in B2, so I don't know why it is returning the date AFTER the one I'm matching.
Thanks
The second part of the formula, the match part, needs to have "H3:H9", not G. The match is looking for your B2 (a date) in the range $G$3:$G$9, which is numbers so there won't be a return of the date.
Edit: And #Jeeped makes a good point, since the dates are going to be found in your table, you would probably be better using "0" instead of "1" at the end - "0" will look for an exact match. If you keep 1, it might return a false positive (return a date that is NEAR your lookup date, not the exact one).
Place in B6 and copy across:
=INDEX($G3:$G9,MATCH(B2,$H3:$H9,1))

Applying an if statement formula for the entire row in excel

I have an if statement working properly in only one cell. =IF(B28="Others",+C28, 0). However, I also want to include the cells B28 to B30 and will add C28 to C30 respectively in the formula. How will I be able to do so? I have tried this formula: =IF(B28:B30="Others",+C28:C30, 0) but it won't work.
What I want to happen is this:
I will input values in the cells C28:C30, and if they're under a certain category (ex. B28 says 'Others'), that value will be added to that category above (ex. C18 for 'Others').
If it works, C18 should have a value of 1,450 since 1,150 and 300 are both under 'Others'.
The function you're looking for is SUMIF(). You can read about it here.
The complete formula you need is: =SUMIF(B28:B30,"Others",C28:C30)
you might want to use a sumif statement where you're summing on the values in C based on the category in B
http://www.exceltrick.com/formulas_macros/excel-sumif-and-sumifs/

EXCEL How do I ignore a cell if a cell has a value

I have a row that will have weekly values entered. Column B has the initial value, and E has the calculation; as I add values to C, D and so on, I want the calculation to skip the previous columns value when the next column gets a value.
B1-C1=E1 BUT when a value is added to D1, E1 would update to B1-D1=E1
Sorry for the horrible description. This is probably answered somewhere on this site but I am not sure what terms to search.
Many thanks!
you can use an if statement. I am not 100% sure of your problem but something like this might be helpful.
if(A1, A1, 0)
So for your example provided.
=B1-if(D1, D1, C1)
This says if there is a value in D1 use D1 else use C1. This works in this example, because if
D1 is empty or 0 you will use the other cell. This may change for any given problem.
Use this if function in E1:
=IF(D1>0,B1-D1,IF(C1>0,B1-C1,B1))
Then enter a value in B1, then C1 then D1 to see the results.
According to your question, you only have room for two entries after the default B1 value. This statement will handle that.
If you need more fields, nest more if functions. But if's can only be nested 7 deep, so you can only have an initial value in B1 and 7 more cells, C1 to I1 with your formula in J1
If you actual data is as simple as your sample data you could just use:
=IF(LEN(D2)>0, B2-D2,B2-C2)
You could also use:
=IF(ISBLANK(D2), B2-C2, B2-D2)
if you prefer but Len is a little shorter and I believe the ISBLANK() function has flaws, If you have a formula in D2 that has a calculation and you set the result to "" then it will pick up as false. It depends on your needs.
I would do the following.
In E1 paste the following:
=A1-INDEX(B1:D1,1,COUNT(B1:D1))
The count formula will tell how many values are present in the range of B:D column. This will be used to catch the last column with an index formula which will be deducted form A1.
One thing is very important! The values from A to D has to be written in sequence, if one column is missing than the calculation will be false.
Hope I could help!

Resources