Excel Variables and Data Analysis

1 Ansicht (letzte 30 Tage)
Carolina Benavides
Carolina Benavides am 23 Jun. 2021
Bearbeitet: Scott MacKenzie am 23 Jun. 2021
I have an excel sheet with about 350,000 rows and 90 columns. For example, the excel sheet has columns: name, graduation cohort, eligible for diploma, and GPA. The name column is text, graduation column is text, eligible for diploma is dictated by either a 0 for false and 1 for true, and GPA is a number.
#1 How can I get the percentage of students (out of all students) that graduated "Fall 2020" and are "Eligible for Diploma"?
#2 How can I get the number of students that are eligible for diploma out of the students that graduated Fall 2020?
#2 How can I get the percentage of students (out of all students) that graduated Fall 2018, Fall 2019, or Fall 2020 and are eligible for diploma?
#3 How can I get the average GPA of students that graduated between Fall 2018, Fall 2019, or Fall 2020 and are eligible for diploma?
Any advise is appreciated!! I have used Matlab very sparingly in the past so I am still a beginner. Youtube videos/web links/reddit posts/etc. are appreciated too!

Antworten (1)

Scott MacKenzie
Scott MacKenzie am 23 Jun. 2021
Bearbeitet: Scott MacKenzie am 23 Jun. 2021
I'm attaching some fake data I put together that match the description of your data. Given this, here's some code to answer your first question. The code uses basic MATLAB logical expressions, and so on. See if you can pull together the code to answer your other questions.
T = readtable('testdata.xlsx');
n = height(T); % total number of students
% #1
a = strcmp(T.Grad_Cohort, 'Fall 2020') & (T.Eligible_for_Diploma == 1);
b = sum(a) / n * 100;
fprintf('Percentage of all students in Fall 2020 cohort and eligible for diploma: %.2f\n', b);
% #2, etc.
% ...
Output:
Percentage of all students in Fall 2020 cohort and eligible for diploma: 14.29

Produkte


Version

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by