1 Reply Latest reply on Aug 16, 2018 5:05 AM by Jim Dehner

# Vlookup with true Case

HI All,

I am new to tableau.

I am looking for some thing which is similar to Vlookup with true in excel for calculation.

Below is my scenario, from table 1 if i filter with product 1. then in parameter if i change service level to 99.5 it should calculate result by lookup the value from table 2  (factor table) (ex., formula vlookup(1- (Service level/100),Table2!A:B,2,TRUE)*Consumption) similar to excel) in this case calculation result will be 1-(99.5/100) = 0.005 and lookup result will be 2.2

therefore my calculated result will be 2.2*24500= 53900

Service level will be my parameter when ever i change the service level it should show the result.

If in case my factor value is not available then show result column as "No Factor"

can anybody help on this. many thanks for your support and help.

Table 1 Data

 Product Product Name ParameterService Level Consumption Result 1 A 99.5 24500 53900

TABLE 2 (i have only these two values in lookup table)

 8.0162e-05 3.42 8.66597e-05 3.4 9.36504e-05 3.38 0.000101169 3.36 0.000109252 3.34 0.000117938 3.32 0.000127269 3.3 0.00013729 3.28 0.000148047 3.26 0.000159589 3.24 0.000171971 3.22 0.000185247 3.2 0.000199477 3.18 0.000214723 3.16 0.000231053 3.14 0.000248537 3.12 0.000267249 3.1 0.000287268 3.08 0.000308678 3.06 0.000331566 3.04 0.000356025 3.02 0.000382154 3 0.000410057 2.98 0.000439841 2.96 0.000471624 2.94 0.000505525 2.92 0.000541674 2.9 0.000580204 2.88 0.000621257 2.86 0.000664983 2.84 0.000711538 2.82 0.000761087 2.8 0.000813802 2.78 0.000869867 2.76 0.00092947 2.74 0.000992813 2.72 0.00106011 2.7 0.00113157 2.68 0.00120743 2.66 0.00128793 2.64 0.00137333 2.62 0.00146388 2.6 0.00155987 2.58 0.00166158 2.56 0.00176932 2.54 0.00188339 2.52 0.00200414 2.5 0.0021319 2.48 0.00226702 2.46 0.0024099 2.44 0.0025609 2.42 0.00272044 2.4 0.00288895 2.38 0.00306685 2.36 0.0032546 2.34 0.00345268 2.32 0.00366158 2.3 0.00388182 2.28 0.00411392 2.26 0.00435843 2.24 0.00461593 2.22 0.00488701 2.2 0.00517228 2.18 0.00547237 2.16 0.00578795 2.14 0.0061197 2.12 0.00646831 2.1 0.00683452 2.08 0.00721908 2.06 0.00762276 2.04 0.00804636 2.02 0.0084907 2
• ###### 1. Re: Vlookup with true Case

Good morning

If you haven't got a response see the attached

it will return this

the 2 formulas are

and the lookup formula is a if - then statement

that I made from your list - I did it in excel and then copy and pasted it (attached) - you did not specify the end conditions so you will want to check them

if [lookupvalue] <= 8.0162E-05 then 3.42

elseif [lookupvalue] <= 8.66597E-05 then 3.42

elseif [lookupvalue] <= 9.36504E-05 then 3.4

elseif [lookupvalue] <= 0.000101169 then 3.38

elseif [lookupvalue] <= 0.000109252 then 3.36

elseif [lookupvalue] <= 0.000117938 then 3.34

elseif [lookupvalue] <= 0.000127269 then 3.32

elseif [lookupvalue] <= 0.00013729 then 3.3

elseif [lookupvalue] <= 0.000148047 then 3.28

elseif [lookupvalue] <= 0.000159589 then 3.26

elseif [lookupvalue] <= 0.000171971 then 3.24

elseif [lookupvalue] <= 0.000185247 then 3.22

elseif [lookupvalue] <= 0.000199477 then 3.2

elseif [lookupvalue] <= 0.000214723 then 3.18

elseif [lookupvalue] <= 0.000231053 then 3.16

elseif [lookupvalue] <= 0.000248537 then 3.14

elseif [lookupvalue] <= 0.000267249 then 3.12

elseif [lookupvalue] <= 0.000287268 then 3.1

elseif [lookupvalue] <= 0.000308678 then 3.08

elseif [lookupvalue] <= 0.000331566 then 3.06

elseif [lookupvalue] <= 0.000356025 then 3.04

elseif [lookupvalue] <= 0.000382154 then 3.02

elseif [lookupvalue] <= 0.000410057 then 3

elseif [lookupvalue] <= 0.000439841 then 2.98

elseif [lookupvalue] <= 0.000471624 then 2.96

elseif [lookupvalue] <= 0.000505525 then 2.94

elseif [lookupvalue] <= 0.000541674 then 2.92

elseif [lookupvalue] <= 0.000580204 then 2.9

elseif [lookupvalue] <= 0.000621257 then 2.88

elseif [lookupvalue] <= 0.000664983 then 2.86

elseif [lookupvalue] <= 0.000711538 then 2.84

elseif [lookupvalue] <= 0.000761087 then 2.82

elseif [lookupvalue] <= 0.000813802 then 2.8

elseif [lookupvalue] <= 0.000869867 then 2.78

elseif [lookupvalue] <= 0.00092947 then 2.76

elseif [lookupvalue] <= 0.000992813 then 2.74

elseif [lookupvalue] <= 0.001060106 then 2.72

elseif [lookupvalue] <= 0.001131567 then 2.7

elseif [lookupvalue] <= 0.001207428 then 2.68

elseif [lookupvalue] <= 0.001287931 then 2.66

elseif [lookupvalue] <= 0.001373327 then 2.64

elseif [lookupvalue] <= 0.00146388 then 2.62

elseif [lookupvalue] <= 0.001559868 then 2.6

elseif [lookupvalue] <= 0.001661579 then 2.58

elseif [lookupvalue] <= 0.001769315 then 2.56

elseif [lookupvalue] <= 0.001883392 then 2.54

elseif [lookupvalue] <= 0.002004137 then 2.52

elseif [lookupvalue] <= 0.002131895 then 2.5

elseif [lookupvalue] <= 0.002267024 then 2.48

elseif [lookupvalue] <= 0.002409896 then 2.46

elseif [lookupvalue] <= 0.002560901 then 2.44

elseif [lookupvalue] <= 0.002720444 then 2.42

elseif [lookupvalue] <= 0.002888946 then 2.4

elseif [lookupvalue] <= 0.003066846 then 2.38

elseif [lookupvalue] <= 0.0032546 then 2.36

elseif [lookupvalue] <= 0.003452682 then 2.34

elseif [lookupvalue] <= 0.003661585 then 2.32

elseif [lookupvalue] <= 0.00388182 then 2.3

elseif [lookupvalue] <= 0.004113919 then 2.28

elseif [lookupvalue] <= 0.004358432 then 2.26

elseif [lookupvalue] <= 0.004615931 then 2.24

elseif [lookupvalue] <= 0.004887008 then 2.22

elseif [lookupvalue] <= 0.005172277 then 2.2

elseif [lookupvalue] <= 0.005472373 then 2.18

elseif [lookupvalue] <= 0.005787954 then 2.16

elseif [lookupvalue] <= 0.006119699 then 2.14

elseif [lookupvalue] <= 0.006468313 then 2.12

elseif [lookupvalue] <= 0.006834522 then 2.1

elseif [lookupvalue] <= 0.007219078 then 2.08

elseif [lookupvalue] <= 0.007622755 then 2.06

elseif [lookupvalue] <= 0.008046355 then 2.04

elseif [lookupvalue] <= 0.008490703 then 2.02

else 2 end

Jim

If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.