• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Excel vlookup formulaes to SQL

kdinuk

New Member
IF I consider 'PREVMNTPV' is one table and 'CURR' is other table and 'CURR' table consists of field1,field2,fied3 and field4. How do I get the below excel formaules to SQL. Please help me out...


col1/field1=IF(T2="Inactive",0,IF(AND(ISNA(VLOOKUP($A2,'PREVMNTPV'!A:B,2,FALSE)),BL2=1),1,IF(ISNA(VLOOKUP($A2,'PREVMNTPV'!A:B,2,FALSE)),0,IF(AND(BL2=1,VLOOKUP($A2,'PREVMNTPV'!A:E,5,FALSE)="Inactive",T2="Active"),1,IF(ISNA(VLOOKUP($A2,'PREVMNTPV'!A:B,2,FALSE)),0,IF(AND(BL2=1,VLOOKUP($A2,'PREVMNTPV'!A:F,6,FALSE)=0),1,0))))))


col2/field2=IF(ISNA(VLOOKUP($A2,'PREVMNTPV'!A:B,2,FALSE)),0,IF(AND(T2="Inactive",VLOOKUP($A2,'PREVMNTPV'!A:K,6,FALSE)=1,VLOOKUP($A2,'PREVMNTPV'!A:E,5,FALSE)="Active"),-1,IF(AND(VLOOKUP($A2,'PREVMNTPV'!A:K,6,FALSE)=1,BL2=0,VLOOKUP($A2,'PREVMNTPV'!A:E,5,FALSE)="Inactive"),0,IF(AND(BL2=0,VLOOKUP($A2,'PREVMNTPV'!A:K,6,FALSE)=1),-1,0))))


col3/field3=IF(OR(T2="Inactive",DI2<0),0,IF(DG2=-1,0,IF(DF2=1,BT2,IF(ISNA(VLOOKUP(A2,'PREVMNTPV'!A:K,8,FALSE)),BT2,IF(AND(BL2=1,(VLOOKUP(A2,'PREVMNTPV'!A:K,8,FALSE)<BT2)),BT2-(VLOOKUP(A2,'PREVMNTPV'!A:K,8,FALSE)),0)))))


col4/field4=IF(ISNA(VLOOKUP($A2,'PREVMNTPV'!A:E,3,FALSE)),0,IF(AND($T2="Inactive",VLOOKUP($A2,'PREVMNTPV'!A:E,5,FALSE)="Inactive"),0,IF(DG2=-1,-1*(VLOOKUP($A2,'PREVMNTPV'!A:K,8,FALSE)),IF(AND(BT2<VLOOKUP($A2,'PREVMNTPV'!A:K,8,FALSE),T2="Active"),BT2-(VLOOKUP($A2,'PREVMNTPV'!A:K,8,FALSE)),IF(BT2-(VLOOKUP($A2,'PREVMNTPV'!A:K,8,FALSE)>0),0,BT2-(VLOOKUP($A2,'PREVMNTPV'!A:K,8,FALSE)))))))
 
Back
Top