VBA Subtotal(9,"range") based on lenght

Status
Not open for further replies.

jocker_boy

Board Regular
Joined
Feb 5, 2015
Messages
83
Hello,

I would like to use some macro to populate cells with the formula subtotal(9,"range"), being the range dinamic, based on the lenght of the cell.
For example:


indentlenghtFormula
F.91.047150
F.91.04.011060
F.91.04.01.071330
F.91.04.01.07.011610
F.91.04.01.07.041620
F.91.04.01.121330
F.91.04.01.12.071630
F.91.04.801090
F.91.04.80.011340
F.91.04.80.021350
F.91.057260
F.91.05.0210260
F.91.05.02.0113260
F.91.05.02.01.0116210
F.91.05.02.01.01.8019210
F.91.05.02.01.01.80.012260
F.91.05.02.01.01.80.022270
F.91.05.02.01.01.80.032280
F.91.05.02.01.021610
F.91.05.02.01.031610
F.91.05.02.01.041610
F.91.05.02.01.051610
F.91.05.02.01.071610

In this table, i have in column A:A my indent value.
I calculate in column B:B the lenght of each cell A:A
My goal is to populate in column C:C, for each cell the formula: =subtotal(9;range), where the range is limited by the lenght number. It should only create the formula if the lenght of the next cell if superior, if it is equal it should be blank.
In this example, all the blues values are obtain in the formula =subtotal(9;range), the range should check the lenght of the column B:B, start the next cell and finish until the lenght is superior.

It is hard to explain.
Sorry,

Gonçalo
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Duplicate VBA Subtotal(9,"range") based on indent

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread.
Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,983
Messages
6,122,591
Members
449,089
Latest member
Motoracer88

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