Nested if formula in excel skipping a step - excel-formula

I am trying to create a formula that:
looks in F4, if blank look in B4, if that is blank add 120 days to K4 if not blank add 120 days to B4
If F4 is not blank add 60 days THEN if those any of those dates are great than todays date enter Y in the current cell otherwise leave blank.
When i run this its fine unless column F4 is blank, it seems to skip over deciding if the updated date is greater than today. What am i missing?
=IF(IF(ISBLANK($F4),IF(ISBLANK($B4),$K4+120,$B4+120),$F4+60>TODAY()),"Y","")

If I am understanding your requirements correctly and if you have the newest version of Excel, LET will help keep everything organized.
=LET(x,
IF(ISBLANK($F4),
IF(ISBLANK($B4),$K4+120,$B4+120),
$F4+60),
IF(x>TODAY(), "Y", ""))
If not, then you will need to test each individually.
Try:
IF(ISBLANK($F4),
IF(IF(ISBLANK($B4),$K4+120,$B4+120)>TODAY(), "Y", ""),
IF($F4+60>TODAY(), "Y", ""))

Related

Excel Formula with Date from other cell

I count the number of Excel entries within a date with the following formula (ZÄHLENWENN = COUNTIF)
=ZÄHLENWENN('2021'!L:L;">=01.11.2021")-ZÄHLENWENN('2021'!L:L;">30.11.2021")
The Formula here is working but since I don't want to enter the date values ​​for every month of the year I have created a calculation with the function end of the month. (MONATSENDE)
How do I have to rebuild the formula when I get the two dates from two cells?
Cockpit E3: =MONATSENDE(D3;-1)+1 -> shows 01.11.2021
Cockpit F3: =MONATSENDE(D3;0) -> shows 30.11.2021
Cockpit D3: =01.11.2021 (the only one entered manually)
Unfortunately the outcome of my new formula is 0:
=ZÄHLENWENN('2021'!L:L;">=Cockpit!E3")-ZÄHLENWENN('2021'!L:L;">Cockpit!F3")
What did i do wrong ?
Greetings
You have to put E3 and F3 as references to the formula - not as a string:
=ZÄHLENWENN('2021'!L:L;">=" & Cockpit!E3)-ZÄHLENWENN('2021'!L:L;">" & Cockpit!F3)
Tip: apply a name to E3 and F3 (e.g. FirstOfMonth, EndOfMonth) and then use the names within the formula. It then gets more "readable" - also for someone else who might maintain the project later.
=ZÄHLENWENN('2021'!L:L;">=" & FirstOfMonth)-ZÄHLENWENN('2021'!L:L;">" & EndOfMonth)
And maybe you should consider using tables for sheet 2021 (Einfügen > Tabelle)

Lookup using multiple columns

I have a sheet filled with data below (and in the image):
Now there's this other sheet where the user will only be inputting the column "Gender" and "Age" values and the excel formula should be fetching the associated factor. Please help me with one such formula.
For e.g. If the user puts Male and 23, the formula should return 3. say Male was entered in Cell D46 and 23 was entered in E46 of Sheet named "Sheet4" and the table shown above happens to be in "Sheet1"
Please advise.
Right, now I can visualize what you meant in your other comments in your previous question, it's a rather easy redo of our other formula.
Formula in F3:
=INDEX(C1:C13,MATCH(1,(ROW(C1:C13)>=MATCH(F1,A1:A13,0))*(B1:B13=F2),0))
Entered through CtrlShiftEnter
Notice that these formulas will return a wrong result if, lets say you extend till females age of 29, and you will search for male, it will still return the value for female. It will however not fail when your searchcriteria would be always right.
You could prevent this in this case (because you only really have one criteria and a fixed range with this formula in F3:
=IFERROR(IF(F1="Male",INDEX(C2:C9,MATCH(F2,B2:B9,0)),INDEX(C10:C13,MATCH(F2,B10:B13,0))),"No result")
Just enter normally. What it does is it checks what gender type is chosen and choses it's lookup index accordingly.
Another option would be to use SUMPRODUCT() like so :
=IF(F1="Male",SUMPRODUCT((B2:B9=F2)*(C2:C9)),SUMPRODUCT((B10:B13=F2)*(C10:C13)))
Also, if you are curious what formulas do and want to learn from them, a great way to do so is using the build-in formula evaluate function, that will show you step by step what the formula will calculate.
EDIT
Tried, as per your comment, to break it down for you so you understand what is going on:
For situations like this, I've learned a good trick how to fill in the blank cells:
Select all cells in the column with the "gender" values.
Goto Special, Blanks. (You active cell should be A3)
In the formula bar, type =A2. (I believe that A2 contains the word "Male")
Press Ctrl+ENTER (don't forget the Control key for filling all selected cells)
As a result, A3 will be copied from A2 and contain the word "Male", A4 will be copied from A3 and will now also contain the word "Male", ...
Further: this stops at the first occurence of the word "Female" (this cell is not selected), and for the later cells, the copying happens in the same way as before.
From here, it should be far easier to achieve your goal.

Subtraction with blank cells - 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,"")

Summing numeric portion of cell when alpha portion of cell is the same

I have a spreadsheet that has columns for dates and the values can be either "1v, .5v, 1p, .5p, 1s, .5s"
I have 3 columns in each row one for each letter "v, p and s". I want to be able to add the total of all cells in the range grouped by letter and then display the sum for each letter in it's respective column (v, p or c).
Here is an example of the sheet:
Name Vacation Personal Sick 1/5/15 1/6/15 1/7/15 1/8/15
Billy 1.5 1 0 .5v 1v 1p
It is the formula that goes in the vacation/personal/sick cell that I just can't figure out.
I went down the array formula route and came up with essentially the same formula as #Sancho.s :-
=SUM(LEFT($E2:$H2,LEN($E2:$H2)-1)*(RIGHT($E2:$H2)="v"))
You could modify it to take account of blanks:-
=SUM(IF($E2:$H2<>"",LEFT($E2:$H2,LEN($E2:$H2)-1)*(RIGHT($E2:$H2)="v")))
Perhaps this would be better, to ignore any mis-formatted cells:-
=SUM(IFERROR(LEFT($E2:$H2,LEN($E2:$H2)-1)*(RIGHT($E2:$H2)="v"),0))
These all have to be put in with Ctrl-Shift-Enter.
Assuming the range you posted starts at A1, use
=SUMPRODUCT((RIGHT($E2:$G2,1)="v")*LEFT($E2:$G2,LEN($E2:$G2)-1))
in B2. Change "v" and the range to use suitably.
Pro:
It is not an array formula. See why this may be important
Con:
I could not make it work with blank cells.
This "array entered" version will also allow blanks
=SUM(IF(RIGHT(E2:G2)="v",SUBSTITUTE(E2:G2,"v","")+0))
confirmed with CTRL+SHIFT+ENTER

Converting MM:SS.ms to seconds using MS excel

I am looking for a neat way of converting a cell from
Minutes:Seconds.Milliseconds to
Seconds.Milliseconds
i.e.
11.111 = 11.111
1:11.111 = 71.111
I have something in place at the moment but its a bit hacky and I am sure there must be some nice excel feature to do this for me :P
Thanks!
Do this:
Place values 0:0:11.111 and 0:1:11.111 in cells B3 and B4 respectively.
Now format it to account for the milliseconds... Select cells B3 and B4, right click and choose Format Cells. In Custom, put the following in the text box labeled Type:
[h]:mm:ss.000
Now on cell C3 put the following formula:
=B3*86400
Fill C4 with the same formula...
Format column C as Number with 3 decimal places.
You're done! :)
Here's a screenshot of the attempt I made and that worked:
Edit:
As you wanna enter only MM:SS.ms you can format the entire B column with a custom format like: mm:ss.000. Now you can enter values as 02:11.111 and it'll convert it accordingly giving you 131.110. Hope it helps.
say your time is in cell A1, place this formula in B1
=IF(LEN(A1)>5,VALUE(TEXT(A1,"[ss].00")),A1)
If the time is less than a minute it outputs the time unaltered, greater than 1 minute it converts it to seconds & milliseconds (2 decimal places).
This will only work if your time in A1 is 10 seconds or greater.

Resources