I am trying to create a workflow to make the lives of my project managers easier.
I have financial profile of a client emailed to me automatically every month. The table lists the overall project information and then individual information for each phase of each project. the information is organized like below:
(Information starts at cell C7, headers are above that)
Snapshot of Table
I want to create an environment where project managers can guess the percent completion of each phase for upcoming months to build a financial outlook plan for the client. Then the totals for each phase is summed and shown on the line for the overall project.
I wanted to automate the formatting process for this file. I could use some guidance or direction?
I have created a general format but do not know the best way to automate this.
Desired Output
Edit:
I came up with some ugly work arounds. But am hoping to clean this up a bit. And I still need a solution for automating the process of bringing in data.
Working Solution V1
I've done the following:
Column K is used to calculate each rows % completion.
Total Contract $$$ / JTD Billed $$$ (columns I/G) =IF(G7>0,I7/G7,)
Columns L, M, N are inputs for the project manager to estimate the completion percentage of each phase by month.
Columns O, P, Q are the outputs calculating the projected billable by month.
(delta % Complete) * Total Contract $$$ (Columns delta(K-N) * G)
However, because I wanted to sum the total billable amounts for each project in the project line, I needed a way to separate the project lines and phase lines.
So, I created Column R with a Boleen value (true/false) to determine if a line was a project overview or a phase. It compares the project number (column C) to the row above it. =IF(C7=C6,TRUE)
Then I needed a way to know how many rows (phases) below a project line belong to the project. I used column S to calculate with =MATCH(1,--(R8:R100=FALSE),0)-1 which counts the number of columns to the next 'False' value.
I then used Columns T, U, V to sum the projected billable per phase per month for the project. =IF(NOT($R7),SUM(O8:INDEX(O8:O1000,$S7,1)),0)
I don't like this formula because its messy. I can't figure out how to write O8:O (like O:O).
And I showed the projected billables with this formula: =IF($R7,IF(AND((L7-K7)*$G7>0,(L7-K7)<1),(L7-K7)*$G7,0),T7). If column R identifies a project row, columns O, P, Q show the sums of the phases. If column R identifies a phase row, columns O, P, Q calculate the billable amount.
Additionally, I used conditional formation using column R to visually distinguish between projects and phases.
Related
So, the point is, in my dataset I have to create a variable "Moving Avg. Amt paid per sq. ft." and the formula or the logic I need is to calculate the last five values as per most recent transactions. i.e. most recent sales by date. but this average should only return value in case it matches the same building and same area variable.
This is what my data looks like
Area ID has three categories. Building number has 5 categories. Date is sorted in ascending order. Now my variable moving average should calculate last 5 averages w.r.t date but for the same building in the same area. e.g. there are buildings 1 and 2 in area 102. I need my Mov Avg. variable to calculate using conditions when it matches criteria of building 1 in 102 for past five sales and when it finds building 2 in the building number variable, it should calculate average of last 5 sales of that building in area 102.
So my approach to this issue was (which is flawed at the moment):
I calculate average of amount paid per sq. foot w.r.t area & building based on dates using the formula
=AVERAGEIFS($N$2:$N$6547,$D$2:$D$6547,D14,$C$2:$C$6547,C14,$B$2:$B$6547,B14)
but I cannot make this formula work, to calculate moving average whenever it meets the criteria. I tried the offset the point as well by 5 but the logic is not right and hence its not working and returning #value in the cells. The formula I used to offset the above condition is
=AVERAGEIFS((OFFSET(N13,5,,5)),$D$2:$D$6547,D13,$C$2:$C$6547,C13,$B$2:$B$6547,B13)
(These formulae are used in column Q of my data)
Need a support from the community as I am badly stuck in making this data useful and I am out of any ideas to make this work.
Edit 1: I am not sure how I can attach my excel file here so you may review the dataset. I have uploaded it on a third party site, for which the link is shared below, so you can view the file in detail.
https://file.io/hlciAHJOHzWA
Expected result is as I have mentioned the instruction said
"Create a variable called "mov. avg amt. paid per sq ft". For each row, this variable should calculate average amt paid per sq ft for the most recent past five sales (by date) for the same building in the same area."
And my approach to build a logic or formula to make this variable calculate moving average w.r.t date for same building in the same area doesn't seem to work because there might be some flaws.
In Office 365 you could use:
=LET(f,FILTER($N$1:N13,($B$1:B13=B14)*($C$1:C13=C14),""),
c,COUNTA(f),
s,SEQUENCE(5,,c-5),
IFERROR(IF(c<5,SUM(f)/c,SUM(INDEX(f,s))/5),""))
If there's less than 5 matches prior to the current sales it'll calculate the average of the count. If 5 or more matches it'll calculate the average of the last 5 prior to the current sale.
I have a Google Sheet (Excel formulas apply) containing 2000 transactions that are structured like below:
Link to Google Sheet with example calcs here.
I need to calculate the Profit (ie. FIFO Capital Gains) for every sell order and place this amount in the 5th column (as pictured). This can be achieved with either traditional formulas or with a Google App Script. Preferably in Google Sheets.
I'm finding it difficult via formulas to match the sell order with the buy as you proceed down the table as some sell orders are split across multiple buy lines. If anyone could help with a formula or solution to tackle this problem it would be much appreciated. This is an updated question to the original here.
PRELIMINARY CONTEXT
Screenshot below refers:
Google sheets here
IMPORTANT UPDATE: re: 2000+ rows, see link in my last comment (for OneDrive template, s.t. expiry, and bottom of this proposal for screenshot of error "too large to import")
fyi: (Office 365 - Excel - fns. such as 'filter' etc., so #Name! will be ubiquitous upon opening this link; however, sharing this should serve as a convenient means to replicate above screenshot in the correct version of Excel)
REQUIREMENTS
Office 365
Adequate space to the right or ability to utilise extra sheet for calcs as req.
APPROACH
High-level | Take-aways
• Relies on 2 additional tables: Qty 'depletion' table (here - G:P) and corresp. Profit Vectors (here - R:Z)
• Compressed representations (2x2 tables, per Summary Tables, here: rows 19:32) could be explored to simplify matters (albeit these are still Work in Progress ['WiP'])
• VB could be attractive alternative too
Low-level | Procedural
Single-cell function could not be found without exceptional complication (however, suspect it could be possible e.g. using FilterXML?)
Qty label transposes filtered negative quantities (grey shaded, G3: J3)
These values are depleted in turn (from left to right, i.e. dependency on having data sorted in ascending order by date (in this depiction, data first sorted by 'fruit' as these are assumed to be independent in the context of the profit calc.)
For example, -5 quantity (G3) offset by +10 (B3) to yield +5 which, in turn contributes towards the -35 qty (H3) to yield -30. No further contribution can be made (left to right); next row (5): +20 avail (given), no offset against -5 (G3, already 'reimbursed', so 20 offset against -30 (H4) to yield -10, and so forth.
Worksheet set up to accommodate longer list of fruit / profits
Result table of residual 'quantities' (~ G:J) applied to price differential to yield 'profit vectors' (R:U) which are summed against corresponding negative quantities to produce Profit score (yellow shaded cells)
FUNCTIONS
Salient functions (all of which should be available within Google Sheet, but for completeness):
1) Profit calc. (E4, drag down):
=IF(B4<0,SUM(INDEX($R$4:$AA$13,0,MATCH(A4&C4,$R$2:$AA$2&$R$3:$AA$3,0))),"")
This can be dragged down / to right as far as desired (in this case, goes to: Z13)
2) Qty table - contents (G4)
=IF($A4=G$2,IF(G$3<>"",IF(G$2=E$1,IF($B4<0,IF(G3<0,G3,0), IF(E4<0,0,E4)+IF(G3<0,G3,0)), IF(G$3<>"", IF($B4<0,IF(G3<0,G3,0),$B4 + IF(G3<0,G3,0))))),G3)
3) Qty table - headers (G2, G3 resp.)
=MID(TRANSPOSE(FILTER(A4:A13&B4:B13,B4:B13<0)),1,SEARCH("-",TRANSPOSE(FILTER(A4:A13&B4:B13,B4:B13<0)))-1)
=-1*MID(TRANSPOSE(FILTER(A4:A13&B4:B13,B4:B13<0)),SEARCH("-",TRANSPOSE(FILTER(A4:A13&B4:B13,B4:B13<0)))+1,LEN(TRANSPOSE(FILTER(A4:A13&B4:B13,B4:B13<0))))
Drag to right as far as desired / able to (this case have been dragged to col. P)
4) Profit table - contents (R4, drag down/right)
=IF(R$2<>"",IF(G3>0,0,IF(G4>0,ABS(G3),G4-G3))*(R$3-$C4),"")
5) Profit table - headers (R2, R3 resp.):
=MID(TRANSPOSE(FILTER(A4:A13&"-"&$C$4:$C$13,B4:B13<0)),1,SEARCH("-",TRANSPOSE(FILTER(A4:A13&"-"&$C$4:$C$13,B4:B13<0)))-1)
=1*MID(TRANSPOSE(FILTER(A4:A13&"-"&$C$4:$C$13,B4:B13<0)),SEARCH("-",TRANSPOSE(FILTER(A4:A13&"-"&$C$4:$C$13,B4:B13<0)))+1,LEN(TRANSPOSE(FILTER(A4:A13&"-"&$C$4:$C$13,B4:B13<0))))
MISC
Alternate solutions derived & explored include triangular frameworks
(rows 17-32).
These tabulate the interaction between values assoc.
with positive and negative quantities positive/negative quantities
(and corres. dates)
Should be noted these are otherwise unnecessary (in terms of functions, previous 'section'
Continuing in the same vein as before....
6a) 1st summary table (Qty): row and col headers (A22 - drag down, C19 - drag right resp.):
=FILTER(D4:D13,1*IF($A$21="*",1,(A4:A13=$A$21))*(B4:B13<0))
=TRANSPOSE(FILTER(D4:D13,1*IF($A$21="*",1,IFERROR((A4:A13=$A$21),1))*(B4:B13>0)))
6b) 1st summary table (Qty): running total (c19, drag down / right as req., in this case: to P19)
=SUM($C21:C21,$B22#)
6c) 1st summary table (Qty): content (c22, drag down or tonight as req.)
=IF(OR(C$20="",$A22=""),"",IF($A22>C$20,MAX(0,C21+MIN(0,SUM($B22:B22))),C21))
7) 2nd summary table (Profits): C29, not draggable
=MIN(C$21,C$21+$B22)*($B29-C$28)
Note; other features of 2nd summary table (row / col headers) follow from 1st. Also, placing '*' in the fruit selection cell (A21) returns all (this is still WiP as mentioned previously).
SCREENSHOTS FOR LARGER UPLOAD:
Explanation: https://www.youtube.com/watch?v=j3Cau-qmSwk
Note: Yes I know it's possible with VBS. But I'm convinced it can be done using some more or less standard Excel features. I simply want to learn more of those features by solving this problem and this is what that bounty is about.
Example: https://drive.google.com/file/d/1s4IvVe-jiHmvlij8Zv0HWLYFzsCV_4nz/view?usp=sharing
Short explanation:
On the second Sheet ( Named Graph ) is what I want to achieve.
Prices for hosts A, B and C are generated by changing number of files on the first Sheet ( Named Prices )
Longer:
I have a graph that compares prices from a few different hosting providers.
Each one calculates it's price based on a few different factors.
For example one charges for views other charges for GB storage other for Transfer. I've brought them to a common denominator "a file number" so when I change a value in a "file" cell all of the prices change accordingly for each hosting provider.
I would like to present that on a graph.
That would give me a better understanding how each one of those hosting providers would scare overtime.
Do I have to input into the file cell 50,100,200,400 copying those prices each time onto the other sheet of is there a better, easier or maybe even more dynamic way to approach this?
Thanks
One solution is to use the following formula:
=(Prices!B$2*$A2*Prices!$B$8)+(Prices!B$3*Prices!$B$7*Prices!$B$8)+(Prices!B$4*Prices!$B$7*$A2)
In your "Graph" sheet, cell B2, where you have the table laying out the values, simply drag it down and across to fill out the other prices and hosts. Changing the file size in column A will update the formulae and thus the value and the graph.
From what I understand the price is calculated as follows
price =
(price per view) * (num of views) +
(price per transfer) * (num of views) * (file size) +
(price per storage) * (num of files) * (file size)
So, just add the appropriate relations in excel for the above price model based on the values you want to track.
I am working on a model of charging load of electric vehicle. I am attaching a link to an excel workbook for your better understanding.
Column B contains random time values
Column G to P represents houses and each house can have 1 car. So the each time values needs to be distributed in one column. Now when a car is plugged in, its load stays constant for 3 cells.
I want excel to randomly distribute these cars e.g. 4 cars to 4 houses and leave others blank.
what i can think of is, to assign each time a random house then use IF formula with AND function to match random times with time series and second condition to match random houses with columns 1-10.
the problem i am facing is, the formula gives a value error and only works in the rows with has random generated time in front of them screenshot. I know there is a very small thing that i am missing. please help me find it
Regards
workbook
=IF(ISNA(MATCH(G$5,$C$6:$C$9,FALSE)),"",IF(AND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE))>=$F6,INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE))<=$F6+TIME(0,30,0)),11,""))
The two elements in the AND find the house number in column C and return the corresponding time in column B.
The first element compares the time in F to that time. The second element compares the time + 30 minutes to F (three cells). If it's between those two times, it gets an 11.
The ISNA makes sure that the house in question is on the list. You could also use an IFERROR, but I prefer the precision of ISNA.
Update
If you want the values to wrap around, you need to OR compare to the next day.
=IF(ISNA(MATCH(G$5,$C$6:$C$9,FALSE)),"",IF(OR(AND(ROUND($F6,5)>=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE)),5),ROUND($F6,5)<=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE))+TIME(0,30,0),5)),AND(ROUND($F6+1,5)>=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE)),5),ROUND($F6+1,5)<=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE))+TIME(0,30,0),5))),11,""))
That formula structure looks like
=If(isna(),"",if(or(and(today,today),and(tomorrow,tomorrow)),11,"")
This formulas already getting too big. If you triple it for your three voltages, it will be huge. You should consider writing a UDF in VBA. It won't be as quick to calculate, but will probably be more maintainable.
If you want to stick with a formula, you could put the wattage in row 4 above the house number. Then in another table, list the wattages and minutes to charge. So in, say, B12:C14 you have
3.7 120
11 30
22 15
Now where you have 11 in your formula, you'd have G$4 and the two placed you have TIME(0,30,0), you'd have TIME(0,INDEX($C$12:$C$14,MATCH(G$4,$B$12:$B$14,FALSE)),0). I re-arranged some stuff to make it more 'readable' (but it's still pretty tough) and here's the final formula
=IF(ISNA(MATCH(G$5,$C$6:$C$9,FALSE)),"",IF(OR(AND(ROUND($F6,5)>=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE)),5),ROUND($F6,5)<=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE))+TIME(0,INDEX($C$12:$C$14,MATCH(G$4,$B$12:$B$14,FALSE)),0),5)),AND(ROUND($F6+1,5)>=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE)),5),ROUND($F6+1,5)<=ROUND(INDEX($B$6:$B$9,MATCH(G$5,$C$6:$C$9,FALSE))+TIME(0,INDEX($C$12:$C$14,MATCH(G$4,$B$12:$B$14,FALSE)),0),5))),G$4,""))
Say I have the dataset below, what is the most efficient formula to fill the cells in column D, where the number of patients alive are calculated?
Example data set in excel
The way it should calculate is:
month 1: 8*100% = 8
Month 2: 8*80%+6*100% = 12.4
Month 3: 8*75%+6*80%+9*100% = 19.8
...
Month 10: etc.
The problem that I have is that which each row, the formula becomes longer. It is feasible to just manually enter the formulas for small datasets, but as datasets become larger, this task becomes unfeasible.
I have been able to use VBA to code the survival of the number of new patients column (C). But then I would have to rerun the VBA code as soon as I change a single value in that column.
I have a feeling it should be possible with some combination of the INDEX function in excel, I just haven't been able to figure it out.
Who can help me out here?
Kind regards,
Sander
If moving the data a bit is allowed at least for the calculation, you could do something like this:
=SUMPRODUCT($F$11:$F$20,B2:B11)
It uses a reversed list of your current list of new patients. That list is created with (formula obtained from this site):
=INDEX($C$11:$C$20,COUNTA($C$11:$C$20)+ROW($C$11:$C$20)-ROW())
Result:
The added space is necessary for the formula to work (so that it gets 0% for patients not present yet).
Or one where you don't have to leave spaces (everything from above is reversed however):
=SUMPRODUCT($C$2:$C$11,G11:G20)