I am currently trying to calculate the XIRR of a huge portfolio containing non-periodic cashflows. The database contains lot of transactions and I want to calculate the XIRR for each one.
This image contains the format and the last column contains the TICKER names of firms. I want to calculate the XIRR for these firms. The database on the left contains all the data for the ticker names
Please find the sample sheet here:
https://docs.google.com/spreadsheets/d/1LnTHOuw5FROyZ8tNo1Zl270RhTDX1gfB2m7jtEU9F_k/edit?usp=sharing
on your sheet you will find a new tab called MK.Help.
This is how you find XIRR for an investment like what you have:
=XIRR({FILTER(D:D*E:E,A:A=H5);-I5},{FILTER(B:B,A:A=H5);TODAY()})
The key is that you need to add the CURRENT HOLDING and todays date at the end of the arrays of cashflows. The idea is to imagine that you liquidated the position right NOW.
Related
I am collecting data on intervals and want to display a summary of that data on a single line in a new sheet.
https://docs.google.com/spreadsheets/d/1EOV4-VwVfwWvhwQ24qkQbCRGxUp74oe0dLWrbj0wiNE/edit#gid=566541214
Grade Data Sheet
Each batch of data comes in by date with a Name, Course and Grade like below
Raw data is like this for a large number of Name / Course / Grade:
Date
Name
Course
Grade
10/1/2022
Joe
Math
65-D
10/15/2022
Joe
Math
58-F
10/30/2022
Joe
Math
50-F
Summary Sheet
Single line that takes each unique Name-Course pair and I'm attempting to lookup a grade for each date column.
(note: I'm trying to extract the dates in the columns dynamically as the Grade Data sheet expands)
So I've successfully extracted the Dates to create new columns, and I am trying to create an index-match that grabs the column date and creates an array of DATE-NAME-COURSE and matches DATE-NAME-COURSE on the Grade Data sheet to return the grade for that student on the Date. The formula works for the first row, but when it fills down it returns the value of the first match.
I can't quite figure out how to reference the single date cell into the array while dynamically filling down. Not sure if I a different approach, but hopefully this makes sense.
=arrayformula(if(len($A2:$A),(index(GradeData!$D2:$D,match(TEXT(C$1,"yyyy-mm-dd")&$A2:$A&$B2:$B,TEXT(GradeData!$A2:$A,"yyyy-mm-dd")&GradeData!$B2:$B&GradeData!$C2:$C,0))),""))`
The goal is to have Grade Data populate automatically, and the Summary page to add a column for each new date and fill data down for each student.
Thanks in advance, I have shared the actual sheet above so you can see the data
I've attempted several different ways but can't quite get the dynamic array matches with the date formatting to work.
=arrayformula(if(len($A2:$A),(index(GradeData!$D2:$D,match(TEXT(C$1,"yyyy-mm-dd")&$A2:$A&$B2:$B,TEXT(GradeData!$A2:$A,"yyyy-mm-dd")&GradeData!$B2:$B&GradeData!$C2:$C,0))),""))
Thank you!
As far as I've seen the issue in your sheet is that the dates of the header do not match the dates of your source data. I've added a new header line:
=LAMBDA(dates,FILTER(dates,regexmatch(dates,"/")))(Transpose(Unique(arrayformula(left(GradeDataVlookup!A4:A,10)))))
And just put an IFERROR in order to avoid all the errors of the values without matches:
=arrayformula(if(len($A$2:$A),iferror(vlookup(TEXT(C$1,"MM/DD/YYYY")&$A2:$A&$B2:$B,GradeDataVlookup!$A:$E,5,FALSE),""),""))
PS: with MAP or MAKEARRAY you could summarize all the table in just one formula
I have this sheet that includes a pivoted table with a range of months in columns and years in the header row and some values in the main table. I want to be able to expand the monthly dates along with the year, id, and values to more easily use it as a look up table to find valid user ids that have a greater value than the look up value for a given year. I provided a sample sheet with limited rows as an example. The row that is highlighted yellow (row 69) makes user 2 valid within year 2022. I would then conditionally highlight the valid user.
I can get the date ranges expanded but I have trouble keeping the other data matched up with the appropriate corresponding rows. I think it would be a fairly straightforward task with apps script but I am a very inexperienced user in that regard.
Here is my sample sheet: https://docs.google.com/spreadsheets/d/1bIji78wYu32O70C2xZLn8dntyYogs5ivuNvCFj5-Z0s/edit?usp=sharing
I am trying to create an athlete database, using input from the athletes, via a Google Form, which links to a spreadsheet.
Each question on the form corresponds to a matching column on the spreadsheet. Apart from the fact that I don't seem to be able to direct replies directly into the spreadsheet (they appear in a separate sheet) everything works acceptably...
However - and there's always a however - I want the athlete's Date of Birth to generate their current age, so I include another column, which - using DATEDIF - gives this figure.
The column isn't on the form, so I have to create it separately for each new entry - currently well over 700 athletes on the database and more to come.
Here's my problem... I have manually linked the DATEDIF formula for every single athlete, using their DoB cell and the A1 cell as TODAY. They all work.
Until I add another entry. Then, below that new entry, although DATEDIF seems able to keep track of the DoB cell for every athlete displaced by the new row, it also adds a row to TODAY, so A1 becomes A2, A3 if there are two new entries, and so on.
Rather than making every single cell in column A into TODAY, is there a way to apply the DATEDIF formula to stop changing A1 as my reference?
This is the formula I am using: =DATEDIF(H2,A1,"Y") my dates are all in dd/mm/yyyy format. The athlete DoBs are all in column H, TODAY is always A1...
This is so far above my head, I seem to have created a beast that I cannot tame, other than by inserting new rows and then re-pointing hundreds of DATEDIF formulae to the correct TODAY cell. And life is too short for that!
Any help greatly appreciated...
Short answer
Use
=DATEDIF(H2,$A$1,"Y") or
=DATEDIF(H2,TODAY(),"Y")
Explanation
Google Sheets references could be relative or absolute. A1 is a relative reference, $A$1 is an absolute reference.
By the other hand, you could use a function as a function parameter.
I'm trying to do a couple of different things with a spreadsheet in Google and running into some problems with the formulas I am using. I'm hoping someone might be able to direct me to a better solution or be able to correct the current issue I'm having.
First off all, here is a view of the data on Sheet 1 that I am pulling from:
Example Spreadsheet
The first task I'm trying to accomplish is to create a sheet that lists all of these shift days with the date in one column and the subject ("P: Ben" or S: Nicole") in another column. This sheet would be used to import the data via a CSV into our calendar system each month. I tried doing an Index-Match where it used the date to pull the associated values however I found that I had to keep adjusting the formula offsets in order to capture new information. It doesn't seem like Index-Match works when multiple rows/columns are involved. Is there a better way to pull this information?
The second task I am trying to accomplish is to create a new tab which lists all the dates a specific person is assigned too (that way this tab will update in real time and everyone can just look at their own sheet to see what days they are on-call). However, I run into the same problem here because for each new row I have to change the formula to reflect the correct information otherwise it doesn't pull the correct cell when it finds a match.
I would appreciate any and all information/advice on how to accomplish these tasks with the formula combination I mentioned or suggestions on other formulas to use that I have not been able to find.
Thanks in advance!
Brandon. There are a few ways to attack your tasks, but looking at the structure of your data, I would use curly brackets {} to create arrays. Here is an excerpt of how Google explains arrays in Sheets:
You can also create your own arrays in a formula in your spreadsheet
by using brackets { }. The brackets allow you to group together
values, while you use the following punctuation to determine which
order the values are displayed in:
Commas: Separate columns to help you write a row of data in an array.
For example, ={1, 2} would place the number 1 in the first cell and
the number 2 in the cell to the right in a new column.
Semicolons: Separate rows to help you write a column of data in an array. For
example, ={1; 2} would place the number 1 in the first cell and the
number 2 in the cell below in a new row.
Note: For countries that use
commas as decimal separators (for example €1,00), commas would be
replaced by backslashes () when creating arrays.
You can join multiple ranges into one continuous range using this same
punctuation. For example, to combine values from A1-A10 with the
values from D1-D10, you can use the following formula to create a
range in a continuous column: ={A1:A10; D1:D10}
Knowing that, here's a sample sheet of your data.
First Task:
create a sheet that lists all of these shift days with the date in one
column and the subject ("P: Ben" or S: Nicole") in another column.
To organize dates and subjects into discrete arrays, we'll collect them using curly brackets...
Dates: {A3:G3,A7:G7,A11:G11,A15:G15}
Subjects: {A4:G4,A5:G5,A8:G8,A9:G9,A12:G12,A13:G13,A16:G16,A17:G17}
This actually produces two rows rather than columns, but we'll deal with that in a minute. You'll note that, because there are two subjects per every one date, we need to effectively double each date captured.
Dates: {A3:G3,A3:G3,A7:G7,A7:G7,A11:G11,A11:G11,A15:G15,A15:G15}
Subjects: {A4:G4,A5:G5,A8:G8,A9:G9,A12:G12,A13:G13,A16:G16,A17:G17}
Still with me? If so, all that's left is to (a) turn these two rows into two columns using the TRANSPOSE function, (b) combine our two columns using another pair of curly brackets and a semicolon and (c) add a SORT function to list the dates in chronological order...
=SORT(TRANSPOSE({{A3:G3,A3:G3,A7:G7,A7:G7,A11:G11,A11:G11,A15:G15,A15:G15};{A4:G4,A5:G5,A8:G8,A9:G9,A12:G12,A13:G13,A16:G16,A17:G17}}),1,TRUE)
Second Task:
create a new tab which lists all the dates a specific person is
assigned too (that way this tab will update in real time and everyone
can just look at their own sheet to see what days they are on-call).
Assuming the two-column array we just created lives in A2:B53 on a new sheet called "Shifts," then we can use the FILTER function and SEARCH based on each name. The formula at the top of Ben's sheet would look like this:
=FILTER(Shifts!A2:B53,SEARCH("Ben",Shifts!B2:B53))
Hopefully this helps, but please let me know if I've misinterpreted anything. Cheers.
I want to create a gradesheet using google sheets, each assignment grades are entered as letters (A thru F). Each grade is given a numerical value - decided dynamically at the end of course.
I want to create a gradesheet in which I can enter each students grades as letters and in the end while calculating the final grade each letter is converted to a number and totalled.
Is there anyway to do this in google sheets.
I suggest you set up a little table as highlighted in the image and name it (I chose GTable):
then apply a lookup formula such as:
=vlookup(A1,GTable,2,0)
If you do so without some kind of table then you may be trying to fix formulae each time the dynamic decision is changed, and fixing a table may be easier.
You could create a second gradesheet based off of the original gradesheet, but instead of letter values, each cell would have something like
=IF(B2="A",100,IF(B2="B",90,IF(B2="C",80,IF(B2="D",70,IF(B2="F",60,0)))))
In this case, B2 is the cell corresponding to the original gradesheet, so each cell in the new gradesheet would correspond to a cell in the original gradesheet. You can then replace the hardcoded numbers with values from the spreadsheet or expand the conditional to cover more letter grades, and use this new table to calculate the final grade.