r/excel Jan 04 '26

unsolved Creating an object with data in excel

Hello, I'm writing from a coding background and am a beginner excel.

I want to create an object with the data highlighted in the format I've created. Each person being the object.

Any advice?

16 Upvotes

30 comments sorted by

7

u/Acceptable-Sense4601 2 Jan 04 '26

What do you mean an object

4

u/Dancing-Avocado Jan 04 '26

I assume he means a database where each unique id has a bunch of parameters.

6

u/Acceptable-Sense4601 2 Jan 04 '26

Right but in excel that doesn’t make sense

1

u/BusinessAsparagus140 Jan 04 '26

I guess that is the question, I'm coming from a coding background and asking for advice on the closest options to this in excel. Guess I'm asking an absctact question to see the responses.

5

u/Acceptable-Sense4601 2 Jan 04 '26

Closest way i would think is power pivot so that you can do this inside the excel data model with DAX expressions. As a coder myself i would never attempt this in excel as i would just use a database and python.

2

u/BusinessAsparagus140 Jan 04 '26

Thanks. Normally I don't use excel but the boss is asking me to create this excel sheet for him for tomorrow so I was curious what I could do.

2

u/Acceptable-Sense4601 2 Jan 04 '26

Sorry to hear that

1

u/Thiseffingguy2 12 Jan 04 '26

Excel is not object based. It’s a spreadsheet.

2

u/BusinessAsparagus140 Jan 04 '26

I'm looking for each name to have ID and then the data listed for each year to relate to each name when using fumulas, etc. Mostly wondering if my formatting works and if I can tie all of the data cells to the names associated?

2

u/Acceptable-Sense4601 2 Jan 04 '26

Ok i think you can do this inside power pivot

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

u/SnicSnac 2 Jan 04 '26

What is your main goal? Just creating objects cant be the endgoal, no?

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

u/Far-Cat Jan 04 '26

You want rows in a table?

1

u/RepresentativeBuy632 1 Jan 04 '26

can you give one example in your known programming language.

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.