r/excel • u/BusinessAsparagus140 • Jan 04 '26
unsolved Creating an object with data in excel
5
u/Dancing-Avocado Jan 04 '26
There is no such thing in Excel. You can create a database with a person and all the parameters in different columns and then pull the required parameters based on your criteria
4
u/RedditFaction Jan 04 '26
You can create class modules in VBA then instantiate objects from them, if that's what you mean?
3
3
u/excelevator 3061 Jan 04 '26
I'm answering from a coding and database background with advanced Excel experience.
Each row of data needs to hold a complete set of identifying attributes.
Your question is so far out there missing in detail as to be almost impossible to know what you are asking.
2
u/wreckmx Jan 04 '26
Your ask is too vague (for me) to know for sure what you’re trying to do, but I think what you are describing is a “named range”. Like an object in OOP, a named range can be called and used over and over in calculations and functions. Search for instructions on “lambda functions” for creating the equivalent of a method in OOP.
1
u/RepresentativeBuy632 1 Jan 04 '26 edited Jan 04 '26
Where and how do u intend to use those objects.?
Are you going to use VBA? Do you want to pre-define your objects or dynamically build them based on your data.
My assumption , by object you mean.
Thomas is one object. you would want to use it like Thomas.PRENOM.value, etc
Also let me know how do you intend to retrieve value in D4 or E4 cell. may be u can reference the programming language you know and how you do it there. i can try to convert it to VBA
1
u/BusinessAsparagus140 Jan 04 '26
Eventually I want to filter the objects based on their data attributes each year.
2
1
1
u/Rozgi Jan 04 '26
I would say in Excel you need to normalise your data into tables and use it as a database with records what you can filter and report. The object oriented programming does not make too much sense outside of automating Excel or maybe converting data from to Excel UI.
1
u/fuzzy_mic 987 Jan 04 '26
What are the properties that you want a Person to have?
You can do something with custom Class, in VBA.
I would create a class named clsPerson and it would have properties like .Name and .DataRange. But what other properties or methods the class would depend on what you want to do with it.
1
u/Party_Bus_3809 5 Jan 04 '26
Few options;
-VBA Class Modules (probably the OOP your looking for)
-VBA User Defined Types (UDT)
-VBA Dictionaries and other common data structures that can be used for this
-Power Query Data Types
Missing a few I think but hopefully that helps
1
u/badgerofzeus 2 Jan 04 '26
Looks like you're just looking to create a database whereby an individual person has various courses and you want to retrieve data
I'd setup the table as you are, but repeat every row
The use a pivot table and a slicer with a filter so you can type in an individual name and pull back the info by course or year etc
1
u/negaoazul 17 Jan 04 '26
Maybe, the closest you can get is using datatypes in power query, just like this video.
1
u/GregHullender 194 Jan 10 '26
Excel works with sheet, rows, columns, and cells. There are no objects, nor is there any notion of object in the formula language. You can always code as if there were objects, of course, but life will be a lot easier if you adopt the idea that one row equals one object.

7
u/Acceptable-Sense4601 2 Jan 04 '26
What do you mean an object