Use the previous non-zero value in a column in calculation within nested if.

MisterGB

New Member
Joined
Nov 13, 2015
Messages
10
Hey again!

In column R, I have the formula:

Rich (BB code):
=MIN(ALS(OF($P3="Auto 2H sword";$P3="Auto Khopesh");$R2+3;ALS(OF($P3="Dismember";$P3="Cleave";$P3="Decimate";$P3="Sever";$P3="Gfury";$P3="Havoc";
$P3="Smash";$P3="Slice";$P3="Tuska";$P3="Sacrifice");$R2+8;ALS(OF($P3="Assault";$P3="slaughter";$P3="Destroy";$P3="Gflurry";$P3="Hurricane";
$P3="Quake";$P3="Btendrils");$R2-15;ALS(OF($P3="Beserk");$R2-100;ALS($P3="vBeserk";$R2-90;ALS($O3="Apot";$R2+25;ALS($O3="EnhApot";$R2+30)))))));100)

Yes, I know it's probably a trainwreck and it's also in Dutch. ALS(OF = IF(OR.

The table that this applies to has zero values in Column R that need to be ignored. The next non zero value above a given cell in column R needs to be used instead of $R3.

Currently column R has the following:

R3: 3
R4: 11 (as Cleave is in cell P4)
R5: 0
R6: 0
R7: 8 (as Decimate is in cell P7)

R7 needs to return to the 11 and add the 8 as in the formula.

As an added bonus, I have entered the formula into R3 and used addressing to fill column R.

I hope that makes some sense!

Thanks,

GB
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I think that this is what you're asking for, formula is in english though, just needs converting back.
Book5
PQR
2
3Auto 2H Sword3
4Cleave11
511
611
7Decimate19
Sheet5
Cell Formulas
RangeFormula
R3:R7R3=MIN(IFERROR(LOOKUP(1E+100,1/(1/R$2:R2)),0)+IF(OR($P3="Auto 2H sword",$P3="Auto Khopesh"),3, IF(OR($P3="Dismember",$P3="Cleave",$P3="Decimate",$P3="Sever",$P3="Gfury",$P3="Havoc",$P3="Smash",$P3="Slice",$P3="Tuska",$P3="Sacrifice"),8, IF(OR($P3="Assault",$P3="slaughter",$P3="Destroy",$P3="Gflurry",$P3="Hurricane",$P3="Quake",$P3="Btendrils"),-15, IF(OR($P3="Beserk"),-100, IF($P3="vBeserk",-90, IF($O3="Apot",25, IF($O3="EnhApot",30))))))),100)
 
Upvote 0
Thanks so much! I was able to combine the 3 repeating cells as each value returned correctly to smarten up the look.

Also, an infinitely eleganter solution I might add :biggrin:
 
Upvote 0
This is what I was referring to above, the list on the right can be hidden away in another sheet, this is one of the easiest ways to clean up long formulas.
Book5
PQRSTUV
2
3Auto 2H Sword3Auto 2H Sword3
4Cleave11Auto Khopesh3
511Dismember8
611Cleave8
7Decimate19Decimate8
8Sever8
9Gfury8
10Havoc8
11Smash8
12Slice8
13Tuska8
14Sacrice8
15Assault-15
16slaughter-15
17Destroy-15
18Gflurry-15
19Hurricane-15
20Quake-15
21Btendrils-15
22Beserk-100
23vBeserk-90
24
25Apot25
26EnhApot30
Sheet5
Cell Formulas
RangeFormula
R3:R7R3=MIN(IFERROR(LOOKUP(1E+100,1/(1/R$2:R2)),0)+IFERROR(VLOOKUP($P3,$U$3:$V$23,2,0),IFERROR(VLOOKUP($O3,$U$25:$V$26,2,0),0)),100)
 
Upvote 0

Forum statistics

Threads
1,215,008
Messages
6,122,672
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top