Dynamic approach to calculating charges against nominal codes (single value, multi value, range & combo)

PureBluff

Board Regular
Joined
Apr 4, 2014
Messages
174
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Trying to simplify some monotonous work for my wife, who looks after a lot of company accounts, these are ever changing. Due to it being financial information, I am not in a position to upload the workbook.

I have written code to look at a range of Company abbreviations, find them in a column & return the column number. She will maintain a configuration worksheet with this list (the easiest end user method I could think of for self maintenance as new companies are opened & added. Happy to hear improvements as I often use this approach to make it more user friendly
VBA Code:
[/B]
With Sheets("Config")
        CfgLastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

For r = 2 To CfgLastRow
Comp = ThisWorkbook.Sheets(Cfg).Range("A" & r).Value

Set cell = Cells.Find(Comp, , xlValues, xlWhole, , , False)
If Not cell Is Nothing Then
  c = Split(cell.Address, "$")(1)]

The Company abbreviations are the sheetnames in a second workbook.

I am now working on the rows, which again, can be altered in the future (inserts, different data on different rows on each sheet), each row has to have a nominal code, except totals, which I can ignore, so Col.B is the ideal list to work/loop through

As you will see the nominal codes have some single values, ranges, multi-value as well values & ranges together.
The codes are fixed to the description but new codes could be added in the future (I could update it for her each time, or use spare cells on the configuration page, to reference)

Workbook.xlsm
BCDEFGH
1Company1Company1Company2Company2BLL
2Actual ForecastActual ForecastActual
34000 - 4099Sales Income (External)
44100Sales Income (Internal)
54101 - 4999Other Income
6Total £0.00£0.00£0.00£0.00£0.00
75000 - 6999Purchases
82220Direct Labour
92210, 2230Employer's Cost
107100, 7103Rent and Rates
117102, 7200 - 7299Heat, Light and Water
127300 - 7350Motor Expenses
137400 - 7499Travelling
147500 - 7503Printing and Stationery
157550 - 7560Telephone and Computer Charges
166201, 7601 - 7606Professional Fees/Advertising
177700 - 7799Equipment Hire and Rental
187800 - 7899Maintenance & Premises Expenses
198201Insurance
May23
Cell Formulas
RangeFormula
D6:H6D6=SUM(D3:D5)


The end result is to perform an aggregation from another workbook - the sheetname is the Company abbreviation and each record in the below has a nominal code, which will allow me to construct a fomula, if I knew how to tackle the varying nominal codes

Mintridge Cashbook.xlsx
ABCD
1Company1
2DateDescriptionNC Purchase InvTax Point Date
5830/05/2023Amazon760201/05/2023
5931/05/2023eBay500624/03/2023
6031/05/2023MrExcel Gift Shop500624/04/2023
CRL



Could someone kindly give me a steer with this? I hope I have explained it well enough.

Many thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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