Formula that looks for a word in a cell and multiplies a value

PETRODATAjames

New Member
Joined
Aug 20, 2022
Messages
21
Office Version
  1. 365
Platform
  1. Windows
I would like a formula that, sorry I will not write this correctly, but here goes. I need this formula to look for a specific word in column, B Product Types and if the word is Credits then multiply by .045, if the word is Food and Beverage then multiply by .050, if the word is Penalty Fees then multiply by .085, and so on. I also would need it, if the word is water, then blank, no multiple by, or multiply by 0, and not display an error, like #REF or something.
 

Attachments

  • Capture.PNG
    Capture.PNG
    68.7 KB · Views: 14

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
what value are you multiplying the lookup value by?
 
Upvote 0
Use this as one of the factors in your formula:

Mr excel questions 41.xlsm
ABCDEFG
1Using LookupUsing Switch
2Credits0.0450.45Credits0.045
3Equipment0.0550.055Equipment0.055
4Equipment0.0550.055Food & Beverage0.05
5Food & Beverage0.050.5Memberships0.065
6Food & Beverage0.050.5Penalty Fees0.085
7Food & Beverage0.050.5Water0
8Memberships0.0650.065
9Memberships0.0650.065
10Memberships0.0650.065
11Memberships0.0650.065
12Penalty Fees0.0850.085
13Water00
PETRODataJames
Cell Formulas
RangeFormula
C2:C13C2=XLOOKUP(B2,$F$2:$F$7,$G$2:$G$7)
D2:D13D2=SWITCH(B2,"Credits",0.45,"Equipment",0.055,"Food & Beverage",0.5,"Memberships",0.065,"Penalty Fees",0.085, "Water",0)
 
Upvote 0
report-sales-tax-by-month-detail (3).csv
ABCDEFGHIJK
1ProductProduct TypeFulfillment LocationPurchase LocationMonthTax Record Revenue Quantity Currency Tax Collected
25 Class Pack CreditsNYCIn-Store2023-06NYC Tax - Credits$ 150.00$ 1.00 USD $ 6.75$ 6.75
354D Ab MatsEquipmentNYCIn-Store2023-06NYC Tax - Equipment NYC$ 39.99$ 1.00 USD $ 1.80$ 1.80
454D Ab MatsEquipmentNYCIn-Store2023-06NYC Tax - Equipment NY State$ 39.99$ 1.00 USD $ 1.60$ 1.80
5C4 EnergyFood and BeverageNYCIn-Store2023-06NYC Tax - Food and Beverages$ 5.00$ 1.00 USD $ 0.23$ 0.23
6CelsiusFood and BeverageNYCIn-Store2023-06NYC Tax - Food and Beverages$ 18.00$ 4.00 USD $ 0.81$ 0.81
7Iconic ProteinFood and BeverageNYCIn-Store2023-06NYC Tax - Food and Beverages$ 25.00$ 5.00 USD $ 1.15$ 1.13
82-Week BootcampMembershipsNYCIn-Store2023-06NYC Tax - Memberships$ 1,764.50$ 4.00 USD $ 79.41$ 79.40
94-Week BootcampMembershipsNYCIn-Store2023-06NYC Tax - Memberships$ 2,700.00$ 2.00 USD $ 121.50$ 121.50
1054D Yearly MembershipMembershipsNYCIn-Store2023-06NYC Tax - Memberships$ 3,324.60$ 5.00 USD $ 149.60$ 149.61
1154D Yearly Membership (One time payment)MembershipsNYCIn-Store2023-06NYC Tax - Memberships$ 2,250.00$ 1.00 USD $ 101.25$ 101.25
12No Show FeePenalty FeesNYCE-Commerce2023-06NYC Tax - Penalty Fees$ 50.00$ 1.00 USD
13Water BottleWaterNYCIn-Store2023-06NYC Tax - Water NY State$ 16.25$ 5.00 USD $ 0.65$ 0.65
report-sales-tax-by-month-detai
Cell Formulas
RangeFormula
K2:K12K2=IF(ISBLANK(J2),"",G2*".045")
K13K13=IF(ISBLANK(J13),"",G13*".040")
 
Upvote 0
May I ask, if I would have to insert the columns with a value using SWITCH? This is the formula I have in place already: =IF(ISBLANK(J2),"",G2*".045"), but I have to edit the .045 value if required.
 
Upvote 0
I gave you two options, one using XLOOKUP that you can easily update your factors as needed. The SWITCH function would require editing the function in the first cell and copying down. IF and SWITCH are not the same. They are similar but not the same. why are you puting the G2* inside the IF statement.
G2 * IF/SWITCH/XLOOKUP is more efficient syntax. But the IF is a less effective syntax.

To use XLOOKUP you would need the 2 helper columns (to hold the lookup table) TO use SWITCH no helper columns are needed.
 
Upvote 0
Excel Formula:
=G2 * XLOOKUP(B2,$F$2:$F$7,$G$2:$G$7)

or

Excel Formula:
=G2 * SWITCH(B2,"Credits",0.45,"Equipment",0.055,"Food & Beverage",0.5,"Memberships",0.065,"Penalty Fees",0.085, "Water",0)
 
Upvote 1
Solution
I'm happy you found a solution, and thanks for the feedback.
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Formula that is like a vlookup, just looking for a name in a cell and multiply by a value - OzGrid Free Excel/VBA Help Forum
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,679
Members
449,463
Latest member
Jojomen56

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