# Returning specfic value based on customer X spend which is an array

#### calvinsheep

##### New Member
I have a question on returning X customer's discount percentage Y, based on their Z spend amount.Ie: I have a list of 5000 customers, Various min and max spend and its corresponding discount. For customer John, i can locate John by index match among the list of customers. Then when at customer John, John has 3 different discount structure based on John's spend (\$0-\$1000 returns 10%, \$1001 to \$2000 returns 20%, \$2001 to \$3000 returns 30%). John has spend \$1500, therefore the output I am after is 20%. How can I write this formula?I have tried using SUMPRODUCT(Customer array 5000 = John)*(Spend1500=> Min amount)*(spend1500=< max amount)*(discount="" array)
if you could kindly shed some light please, it would be much appreciated thanks.

Last edited by a moderator:

#### Marcelo Branco

##### MrExcel MVP
Welcome to Mr Excel forum

Maybe something like this

 A​ B​ C​ D​ E​ F​ G​ H​ 1​ Customer​ Min​ Max​ Discount​ Customer​ Spend​ Result​ 2​ Mike​ 0​ 1000​ 10%​ John​ 1500​ 20%​ 3​ Mike​ 1001​ 2000​ 20%​ 4​ Mike​ 2001​ 3000​ 30%​ 5​ John​ 0​ 1000​ 10%​ 6​ John​ 1001​ 2000​ 20%​ 7​ John​ 2001​ 3000​ 30%​ 8​

Formula in H2
=SUMIFS(D2:D7,A2:A7,F2,B2:B7,"<="&G2,C2:C7,">="&G2)

Hope this helps

M.

#### calvinsheep

##### New Member
Thank You so much Marcelo!! works like a charm... i guess i was tying to over complicate things with SUMPRODUCT - as i remember i used it before for something similiar in the past!
Much appreciated..

1,082,316
Messages
5,364,483
Members
400,802
Latest member
RichBRich

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...