Need some help with variables and loop

psulion01

Board Regular
Joined
Sep 25, 2002
Messages
127
Below is a rough template of the sheet I'm using. I want to define the symbols in the code and associate a commission value to them (i.e. ABC = .05, DEF = .06). In the Gained/Lossed column I want to product of the commission * shares to be populated. some symbols have a minimum value (i.e. $50) while others have no minimum. Also, if $100 or over, data must be populated in Gained, and anything less than $100 must be lost.

I want the code to look in the Symbol column, then match the symbol to the commission value defined in the code, and output the total. If the symbol on the sheet isn't defined in the code I would want an error to be output on the sheet.

I've got a general understanding of IF-Then statements and general BASIC programming, but can't figure out how to define the commission rates and get an error to output.

Any help is greatly appreciated!
Mike
temp sheet.xls
ABCDEFGHIJ
19/27/02
2
3A/CNAMEA/C#B/SSYMSHSPRICEDATEORDER#GainedLost
4SmithSELLABC10000$500.00$0.00
5SmithSELLABC200$0.00$10.00
6DoeBUYDEF5000$300.00$0.00
7DoeBUYDEF100$0.00$50.00
Sheet1
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Jim North

MrExcel MVP
Joined
Jun 20, 2002
Messages
791
You will need to build a crossreference table somewhere (possibly on a different sheet) that crossreferences your symbol to a percentage. Then in the calculation use a VLOOKUP to get the related percentage.
 

Forum statistics

Threads
1,143,709
Messages
5,720,390
Members
422,282
Latest member
psunith

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
Top