Nested IF with XLOOKUP

%3CLINGO-SUB%20id%3D%22%5C%26quot%3Blingo-sub-3140230%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3ENested%20IF%20with%20XLOOKUP%26lt%3B%5C%2Flingo-sub%26gt%3B%3CLINGO-BODY%20id%3D%22%5C%26quot%3Blingo-body-3140230%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CP%3EI%20have%20a%20worksheet%20that%20I%20use%20to%20create%20rates%20for%20an%20insurance%20quote.%26nbsp%3B%20I%20put%20the%20persons%20Age%20and%20Annual%20income%20in%20and%20it%20tells%20me%20how%20much%20of%20the%20insurance%20(in%20dollars)%20they%20qualify%20for%20(that%20is%20just%20based%20on%20their%20income.%26nbsp%3B%20So%20in%20column%20A%20I%20have%20their%20Age%20and%20in%20column%20B%20I%20have%20their%20annual%20income%2C%20and%20using%20a%20formula%20column%20C%20is%20populated%20with%20the%20amount%20of%20coverage%20they%20qualify%20for%20in%20dollars.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EThen%20In%20column%20D%2C%20I%20want%20it%20to%20calculate%20the%20rate%20for%20that%20coverage.%26nbsp%3B%20The%20rate%20is%20based%20on%20their%20age%20and%20their%20are%205%20age%20bands%20(18-49%2C50-59%2C60-64%2C65-69%2C70%2B).%26nbsp%3B%20So%20on%20another%20worksheet%2C%20I%20have%20column%20A%20which%20has%20all%20the%20different%20dollar%20amounts%20they%20could%20qualify%20for%20(From%20%24400%20-%20%242%2C500%20in%20%24100%20increments).%26nbsp%3B%20Columns%20B-F%20are%20the%20rates%20by%20age%20band.%20We%20know%20how%20much%20they%20qualify%20for%20-%20it's%20in%20column%20C%20on%20the%20first%20worksheet%20A.%26nbsp%3B%20So%20the%20logic%20I%20need%20to%20represent%20in%20a%20formula%20is%2C%20look%20at%20the%20amount%20they%20qualify%20for%20in%20worksheet%201%2C%20column%20C.%26nbsp%3B%20Then%20go%20to%20worksheet%202%20and%20find%20the%20row%20in%20column%20A%20that%20matches%20the%20number%20in%20Worksheet%201%2C%20column%20C%2C%20the%20dollar%20amount%20qualified%20for.%26nbsp%3B%20Then%2C%20depending%20on%20the%20age%20band%20they%20fall%20into%2C%20return%20the%20rate%20that%20is%20listed%20in%20that%20age%20band's%20column%20(B-F)%20that%20is%20in%20the%20same%20row%20as%20the%20amount%20they%20qualified%20for.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3ESo%20figure%20WKSHT%201%20has%3A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E54%20years%20old%20in%20column%20A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%2430%2C000%20Annual%20Income%20in%20column%20B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EThey%20qualify%20for%20%24900%2Fmonth%20income%20replacement%20-%20column%20C%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3ENow%20on%20WKSHT%202%20we%20have%3A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EColumn%20A%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Column%20B%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BColumn%20C%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BColumn%20D%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%24%20Qualified%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BRate%20Ages%2018-49%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Rate%20Ages%2050-59%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3BRate%20Ages%20(60-69)%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%24800%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%241.50%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%241.75%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%242.00%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%24900%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%243.00%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%243.25%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%243.50%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%241%2C000%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%244.50%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%244.75%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%245.00%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%241%2C100%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%246.00%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%246.25%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%246.50%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EI%20want%20the%20formula%20to%20look%20at%20the%20%24900%20this%20person%20qualifies%20for%20(from%20WKSHT%201%2C%20Col%20C)%20then%20go%20to%20WKSHT%202%20and%20find%20the%20%24900%20in%20Column%20A%2C%20then%20go%20across%20and%20return%20the%20rate%20for%20the%20persons%20age%20-%2054%20-%20which%20should%20be%20%243.25.%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EHere%20is%20what%20I%20tried%20but%20it%20wont%20work%3A%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%3DIF(D75%26lt%3B50%2C(D75%3DXLOOOKUP(J75%2C'GVDI%20773'!C19%3AC40%2C'GVDI%20773'!D19%3AD40))%2C(N871%3DXLOOKUP(J75%2C'GVDI%20773'!C19%3AC40%2C'GVDI%20773'!E19%3AE40))))%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%26lt%3B%5C%2FP%26gt%3B%3C%2FP%3E%3CP%3EAny%20help%20would%20be%20greatly%20appreciate%26lt%3B%5C%2FP%26gt%3B%26lt%3B%5C%2Flingo-body%26gt%3B%3CLINGO-LABS%20id%3D%22%5C%26quot%3Blingo-labs-3140230%5C%26quot%3B%22%20slang%3D%22%5C%26quot%3Ben-US%5C%26quot%3B%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%26lt%3B%5C%2Flingo-label%26gt%3B%26lt%3B%5C%2Flingo-labs%26gt%3B%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3C%2FLINGO-SUB%3E
Occasional Visitor

I have a worksheet that I use to create rates for an insurance quote.  I put the person's Age and Annual income in and it tells me how much of the insurance (in dollars) they qualify for (that is just based on their income.  So in column A I have their Age and in column B I have their annual income, and using a formula column C is populated with the amount of coverage they qualify for in dollars.

 

Then In column D, I want it to calculate the rate for that coverage.  The rate is based on their age and their are 5 age bands (18-49,50-59,60-64,65-69,70+).  So on another worksheet, I have column A which has all the different dollar amounts they could qualify for (From $400 - $2,500 in $100 increments).  Columns B-F are the rates by age band. We know how much they qualify for - it's in column C on the first worksheet A.  So the logic I need to represent in a formula is, look at the amount they qualify for in worksheet 1, column C.  Then go to worksheet 2 and find the row in column A that matches the number in Worksheet 1, column C, the dollar amount qualified for.  Then, depending on the age band they fall into, return the rate that is listed in that age band's column (B-F) that is in the same row as the amount they qualified for.

 

So figure WKSHT 1 has:

54 years old in column A

$30,000 Annual Income in column B

They qualify for $900/month income replacement - column C

 

Now on WKSHT 2 we have:

 

Column A        Column B                 Column C                 Column D

$ Qualified       Rate Ages 18-49        Rate Ages 50-59     Rate Ages (60-69)

$800                $1.50                        $1.75                          $2.00        

$900                $3.00                        $3.25                          $3.50

$1,000             $4.50                        $4.75                          $5.00

$1,100             $6.00                        $6.25                          $6.50

 

I want the formula to look at the $900 this person qualifies for (from WKSHT 1, Col C) then go to WKSHT 2 and find the $900 in Column A, then go across and return the rate for the persons age - 54 - which should be $3.25.

 

Here is the concept I was trying working on the =IF functionk:

 

=IF(D75<50,(D75=XLOOOKUP(J75,'GVDI 773'!C19:C40,'GVDI 773'!D19:D40)),(IF49<D75<59,=XLOOKUP(J75,'GVDI 773'!C19:C40,'GVDI 773'!E19:E40),IF(59<D75<69,=XLOOKUP(J75,'GVDI 773'!C19:C40,'GVDI 773'!F19:F40)))

 

Any help would be greatly appreciated!

1 Reply

@ADWALLER 

 

First, I would separate the From/To ages into separate cells. So, I would set up the table like below on Sheet2:

 

JMB17_0-1644367073845.png

 

Then, on Sheet1, were A2=54, B2=30000, C2=900, you could enter this formula in D2 to perform your conditional tests and multiply it out (assuming you have office 365):

=SUM((Sheet2!$B$2:$D$2<=A2)*(Sheet2!$B$3:$D$3>=A2)*(Sheet2!$A$4:$A$8=C2)*Sheet2!$B$4:$D$8)

 

If you don't have office 365, then I would just change "SUM" to "SUMPRODUCT".

=SUMPRODUCT((Sheet2!$B$2:$D$2<=A2)*(Sheet2!$B$3:$D$3>=A2)*(Sheet2!$A$4:$A$8=C2)*Sheet2!$B$4:$D$8)

 

JMB17_1-1644367348531.png