countif and sumproduct (i think)

jj_martin_87

New Member
Joined
Jan 20, 2017
Messages
8
[FONT=&quot]I have an excel sheet with a column of dropdowns for different values. If the value is “apples” I want it to multiply the value by 4%. if there is a cell in the column where apples is chosen, i need it to multiply by 5%. A third 6%. Right now i have two formulas in place

=iferror(if(E21="apples",K21*vlookup($Q$2,$O$2:$P$4,2,false),P21*vlookup(E21,$J$2:$K$14,2,false)),"")

=countif(E21:E37,"apples")

This table represents O1:Q4

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
[/FONT]

apples countratecurrent apples count
14.00%1
25.00%
36.00%

<colgroup><col style="width: 100px"><col width="85"><col width="100"></colgroup><tbody>
</tbody>
[FONT=&quot] [/FONT]
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi,

Try this
=C1*INDEX(E1:F3,MATCH(COUNTIF(A1:A2,"apple"),E1:E3,0),2)

change range as per your data
 
Upvote 0
That works to multiply by 4%, but doesnt increase based on the number of times apples is mentioned.

this might make it clearer

paidtotalapples countratecurrent count
apples



$100.00$5.0014.00%2
apples



$100.00$5.0025.00%
bananas



$100.00$0.0036.00%

<colgroup><col style="width: 100px;"><col width="100"><col width="114"><col width="100"><col width="106"><col width="100"><col width="100"></colgroup><tbody>
</tbody>

I would like the first row with apple to still be multiplied by 4% the second by 5% third by 6%
Formulas are:
=countif(G59:G61,"apples")
=iferror
(if(G59="apples",H59*vlookup($M$59,$K$59:$L$61,2,false),P21*vlookup(G59,$J$2:$K$14,2,false)),"")
 
Upvote 0
in the scenario above, (apples chosen twice) it would be $9. (first apple at 4%=$4 second apple at 5% = $5). Right now, if the apples count is two, it multiplies both by 5% based on the vlookup.
 
Upvote 0
<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
paidtotalapples countratecurrent count
apples



100$4.0014.00%1
bananas



10025.00%
oranges



10036.00%

<colgroup><col style="width: 100px"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
paidtotalapples countratecurrent count
apples



100$5.0014.00%2
apples



100$5.0025.00%
oranges



10036.00%

<colgroup><col style="width: 100px"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>
 
Upvote 0
=iferror(if(A2="apples",B2*vlookup($G$2,$E$2:$G$4,2,false),E2*vlookup(E1,$J$2:$K$14,2,false)),"")
=countif(A2:A4,"apples")
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,952
Members
449,198
Latest member
MhammadishaqKhan

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