Need help combining formulas into a multiple IF statement - excel-formula

I'm having trouble writing a formula that will work and was hoping someone could offer assistance with something that requires multiple IF's.
Formula in J4 and J6: =($A$2-F6+1)/($A$2-DATE(YEAR($A$2),1,0))
Formula in J5: =(G5-DATE(YEAR(G5),1,0))/(A2-DATE(YEAR(A2),1,0))
What I want is a formula that can combine the two above formulas, with a max of 1.
IF Column G is Blank, then I want the formula from J4 and J6 with the number capped at 1.
IF Column G is NOT Blank, then my formula from J5.
I keep getting errors whenever I attempt to write this with multiple IF's in the same statement.
I want one formula that would yield 1 on J4, .344444 on J5, and .65555 on J6.
Thank you for your help!

Use this:
=MIN(1,IF(G4<>"",(G4-DATE(YEAR(G4),1,0))/($A$2-DATE(YEAR($A$2),1,0)),($A$2-F4+1)/($A$2-DATE(YEAR($A$2),1,0))))

Related

Problem with IF AND and Vlookup nested formula

I am trying to put a nested IF, AND and Vlookup formula. I want formula to return the value "0.17" in cell F3 if cell D3 has text "pasha" and B3 is not equal to cells mentioned in vlookup formula but its returns zero instead of showing 0.1. Please guide, TIA
=IFERROR(IF(AND(D3="Pasha",VLOOKUP(B3,G70:H78,2,0)<>B3),0.17,IF(VLOOKUP(B3,$B$69:$B$89,1,0)=B3,0.15,"")),0)
enter image description here
You may want to replace
VLOOKUP(B3,G70:H78,2,0)<>B3)
(Excel will unsuccessfully try to match B3 value with values from G column range while it contains different type of data:“Pasha”)
with
NOT(ISNUMBER(MATCH(B3,H70:H78,0)))
And feel free to adjust the second VLOOKUP accordingly.
So, how about this:
You need to to sort the vlookup() but the process for testing the conditions is there.

How to simplify 64 levels of nesting formula in Excel?

I encountered "64 levels of nesting" issue while working on my formula. Is there any way to simplify this formula? This formula worked fine up from 10 to 500 (G:G) but once over 510 something, it encountered "64 levels of nesting" issue. I found some solutions that involved lookup and match-index, but I can't see where/how to implement it here.
Formula is in cell B3:
=IF(B2<=$G$2,B2+($E$2*B2),IF(AND(B2>$G$2,B2<=$G$3),B2+($E$3*B2),IF(AND(B2>$G$3,B2<=$G$4),B2+($E$4*B2),IF(AND(B2>$G$4,B2<=$G$5),B2+($E$5*B2),IF(AND(B2>$G$5,B2<=$G$6),B2+($E$6*B2),IF(AND(B2>$G$6,B2<=$G$7),B2+($E$7*B2),IF(AND(B2>$G$7,B2<=$G$8),B2+($E$8*B2),IF(AND(B2>$G$8,B2<=$G$9),B2+($E$9*B2),IF(AND(B2>$G$9,B2<=$G$10),B2+($E$10*B2),IF(AND(B2>$G$10,B2<=$G$11),B2+($E$11*B2),IF(AND(B2>$G$11,B2<=$G$12),B2+($E$12*B2),IF(AND(B2>$G$12,B2<=$G$13),B2+($E$13*B2),IF(AND(B2>$G$13,B2<=$G$14),B2+($E$14*B2),IF(AND(B2>$G$14,B2<=$G$15),B2+($E$15*B2),IF(AND(B2>$G$15,B2<=$G$16),B2+($E$16*B2),IF(AND(B2>$G$16,B2<=$G$17),B2+($E$17*B2),IF(AND(B2>$G$17,B2<=$G$18),B2+($E$18*B2),IF(AND(B2>$G$18,B2<=$G$19),B2+($E$19*B2),IF(AND(B2>$G$19,B2<=$G$20),B2+($E$20*B2),IF(AND(B2>$G$20,B2<=$G$21),B2+($E$21*B2),IF(AND(B2>$G$21,B2<=$G$22),B2+($E$22*B2),IF(AND(B2>$G$22,B2<=$G$23),B2+($E$23*B2),IF(AND(B2>$G$23,B2<=$G$24),B2+($E$24*B2),IF(AND(B2>$G$24,B2<=$G$25),B2+($E$25*B2),IF(AND(B2>$G$25,B2<=$G$26),B2+($E$26*B2))))))))))))))))))))))))))
Cells $A2:$A26 & cells $E2:$E26 are variable. Cells $D2:$D26 are just my indicator. Others are constant value.
Cells $B2:$B26 will calculate the formula $A2+$A2* percentage. The percentage is based on the value which is in cells $E2:$E26. The value is then determine by the value in cells $A2:$A26.
Formula in cells $B2:$B26 are as previous formula dragged down.
Example:
If the cost is 50. The value of percentage will be taken from cell $E$7. In this case is 10 thus returning the value in $B$6 to $A6+$A6*10=55
Please refer to ss 2.
excel screenshot 2
If you reach the nesting limit that nearly always means there's an easier way....
You should be able to do this much more simply with a lookup type formula, e.g.
=B2+B2*IF(B2<G$2,E$2,INDEX(E$3:E$26,MATCH(TRUE,INDEX(B2>G$2:G$25,0),0))
This finds the first value in column G which is > B2 and then gets the required value from the next row in column E
The only thing this formula doesn't do is impose an upper limit on B2 (yours is the G26 value 250). If that's an issue you can just add an extra IF to cater for that
You might want to rework your tables but an INDEX/MATCH with a relative lookup on ascending data will return the correct percentage.
=b2*index(e2:e26, match(b2, g2:g26, 1))
Not 100% sure I understand your formula/intent. I think I got it...if not please clarify.
add another column that does the math in column H. enter this formula and drag down.
=($B$2+(E2*$B$2))
in cell B3 enter this formula
=VLOOKUP(ROUNDUP(B2,-1),G:H,2,FALSE)

Excel Nested Conditional If Formula with Binary 0 or 1 Output

I am trying to use a multi-nested conditional Excel formula properly. I think what I have is close but I'm missing something.
=IF(BF6=1,IF(AI6=AI9,IF(BC8=0, 0,1)))
I am not sure I can use AI6=AI9 to specify that the contents of these cells are identical.
Separately, I want this formula to repeat every 7 rows, so I expanded the formula to include the this function:
=IF(MOD(ROW()-1,7),"",IF(BF6=1,IF(AI6=AI9,IF(BC8=0, 0,1)))
Any advice would be appreciated.
Screenshot of problem with new formula: =IF(AND(EXACT(AI6,AI9),BF6=1,BC8=0),1,0)
Image of final formulas that work
In the end, I had to use two formulas in two consecutive cells to make it calculate correctly.
=IF(EXACT(AI6,AI9), 1,0)
=IF((AND(BB9=1, BF6=1, BF9=0)), 1, 0)
I will conquer using IF, AND and EXACT in one conditional formula some other time. Thanks for all the help!
REVISED:
From what I understand, this is what you want. Copy the following formula and paste on cell BB9 then drag the formula down to where the record ends.
=IF(MOD(ROW()-2,7),"",IF(AND(AI6=AI9,BH6=1,BH9=0),1,0))
MOD(ROW()-2,7) is to determine where the result should show. Row() means the current row, and I subtract 2 to eliminate header row and blank row on row 2. 7 is to repeat every 7 rows.

Dynamical SUMIF command

If it is possible, I'd like to create a formula that will allow me the following:
Formula must be in the entire column or in this example, in the range B1:B5. The formula is based on a condition, that when the total sum of cells from column A is lower D1, than it gives "X". If the total sum is over D1, then it gives an empty field - "".
In this example the total sum of the cells, that are over D1 value is in the first 3 rows, hence the three X-es, and then it stops.
(source: shrani.si)
.
I presume it would be possible to do this with multiple SUMIF commands, but does anyone know a smoother solution for this?
Thanks!
You can do this easily by using an absolute reference for the starting point of a SUM and using a relative reference for the end point. When copied down, this formulas works fine.
=IF(SUM($A$1:A1)<$D$1,"x","")
Results
Try this
=IF(SUM(OFFSET(A1,0,0,$A$1:A1,1))>$D$1,"X","")
This formula should start at B1 and then you use auto-increment to populate other cells

Fetch SUM of columns above column

I am building an excel formula, where i want to do something like below
Suppose i have 10 rows in excel sheet
I have values in B1 to B9, i want to create a formula so that sum is shown in C10.
I know it is simple =SUM(B1-B10) but only in case when number of rows are fixed.
Whereas in my case, i also want this relation to work if i keep on adding any number of rows, so
C(n) should always give a sum of B(1) to B(n-1)
I have tried indirect but not able to use it convincingly
Try this in C10
=SUM(OFFSET(B$1,0,0,ROW()-1,1))
Assuming you fix C1=0, the formula you should use is
[C2] =OFFSET(C2,-1,-1)+OFFSET(C2,-1,0)
and fill down.

Resources