Defining and using Dynamic Named Ranges in Excel - excel

I have a very long list of years and associated pension-agreements for each year in an excel sheet (approx 800,000 rows). Just two columns--See examples below in columns A and B.
I want to define a set of Dynamic Named Ranges and set each range to a 10-year span. That is, group nr 1 (in col D) i want to define as a dynamic named range for the years 1910-1919. Group nr 2 (Group2) is a named range for the years 1920-1929, and so on. Continuing all the way to year 2022. Thus there will be about 12 groups in total, where each group will contain thousands of different agreements for a 10 year span.
I want to dynamically get a count of cells for each group using the Lowest and Highest years for the Group range (Cols E and F). I say dynamically, since there will be new agreements being added to my list all the time (cols A and B).
Each group should be named using the names defined in Column D (Group1, Group2, etc). Column G will be the count for each group i.e. each group being a 10 year span. For the example below, I have manually counted the cells for each, my goal is to use a set of formulas to get the count instead.
Anyone know how to do kind of count using dynamic named ranges in Excel?

Related

VBA equivalent to an index small function

Hi I have used this formula many times in excel but would like to be able to make a VBA code for it. Based off the criteria in a column "L" I would like to find the 1st and 2nd matches of name in a separate column G and add and subtract the corresponding values associated to that name (on the same rows) in different columns.
Formula: =IF(L3="1:1",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),IF(L3="2:2",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))+INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),2))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),"")
There may be a different way in VBA, this was working in the worksheet so far but got really long based of all the different criteria that could come up in column "L". My data set is about 4000 lines long with many different combinations
My data is as follows: and the expected answers are in column M using the above formula.

How do I SUM a column based on the match of 2 other columns with different sizes in Excel

Hello fellow developers,
I'm currently working on an accounting worksheet, and I'm stuck in one formula (by the way, i don't want to use VBA).
I need the SUM of a database based on a column, in ONE CELL (this is very important because i will make this sum in a lot of other cells based on other criterias)
1 - I have one table column with 25k rows (it will increase every month).
2 - I have another table with 250 financial accounts,
3 - I need in one formula the sum of column 2 from table 1, that matches the column 1 from table 1 with the accounts from table 2,
I tried SUMPRODUCT( and SUM(IF(, but my problem was comparing two ranges with different sizes since one has 25k and another 250
Any Ideas?
Thanks ^^

Excel: Use cell or row only once

I have a list of 1000's of unique identifiers (locations), each with a value attached. EG:
LOCATION_A 10
LOCATION_B 3
LOCATION_C 6
LOCATION_D 12
LOCATION_E 6
etc
I want to create a rule whereby once a value for a location has been used, that location can no longer be used in further calculations.
At the moment I use VLOOKUP to return the values. I suppose I could instead create a calculation row by row (for each location), but with thousands to get through this doesn't seem appropriate.

Determine average of values in a column based upon a column with a unique identifier via Excel 2010

I am trying to determine the average of values in a column based upon a column with a unique identifier. I have included a picture for clarification.
Column A represents block groups, of which there are 27 unique groups. Column E represents the year a structure was built within that block group. There are multiple instances of the same block group number in Column A and I would like to aggregate each of these block group numbers and determine the average year built for all of the structures in each of the 27 block groups.
For example, there are 18 cases of block group '240419601001' and my goal is to average the years associated with this block group number and then have that result appear in a new column.
My end goal is to take these averages and use them to fill in rows where there is no year built associated with a specific block group.
Thanks.
You want AverageIf():
=AVERAGEIF(A:A,"240419601001",E:E)
so in an empty column put this formula in row 2:
=IF(E2="",AVERAGEIF(A:A,A2,E:E),E2)
Then copy and past just the values over column E.

Excel comparing 2 workbooks, combining them and then comparing

I want to compare two price lists for different years from a supplier.
I have multiple items (thousands) with multiple different size codes for each and then prices for each item for each size.
I want to combine the two price lists, (I have 1 'Cost' column in Euros and 1 in Sterling 'Our Price' with delivery included for each period). Some items (or particular sizes) are unique to either list. The items which appear in each list I want to compare the prices of (then work out +/- of change, which I'll work into %'s). But I'm falling at the first hurdle!
How do I create a third sheet from the first 2 sheets (I've got both documents as different sheets within the same workbook) with a combined list, showing the prices for one year in one column and the prices for the second year in the next... Obviously items appearing in 1 year I want to only have 1 price for and a blank for the other!
Example of the data.
This is the formula I'm using at the moment =LOOKUP(A2,'2010'!A$2:A$7940,'2010'!B$2:B$7940)
Which is almost working.
For some reason Excel is looking through the other sheet and not finding all the exact matches to the source... Some it does, most it doesn't and it is then taking an average of similar matches?!
LOOKUP only works when the values in the lookup area are sorted in ascending order. You will be better off with using VLOOKUP and setting the last parameter to false:
=VLOOKUP(A2,'2010'!A$2:B$7940,2,false)

Resources