How Do I Nest IF Functions in Order to Calculate Daily Revenue? - excel

I am working on a data set and I need to calculate the daily revenue of fake AirBnb listings using nested IF statements. This is for a bootcamp I am attending, and I am stuck.
My instructions are as follows:
Estimate revenue per listing
Assume each booking always has 2 guests, unless the listing accommodates only one;
The booking is always for the minimum number of days allowed;
Only half of the bookings generate a review;
The extra person charge is per night (column name ‘extra_people’)
○ Format: have a column that calculates daily revenue (account for number of guests accommodated, number of guests included in the price, extra charge for additional people - using nested IF statements); another column would then calculates revenue per booking; finally, multiply that by the number of total stays the listings has had.
Using the data in my dataset, I am attempting to fill out column AA. So far this is what I have for my formula,
However, I get an error. I know the first part of this formula would work for the scenario in row 4. However, I need to make sure that the formula takes into account scenarios where the "guests included" is less than the "accommodates", because I must assume that each booking always has two guests except for when the listing only accommodates one person.
How should this formula be written? Can I not create equations within nested if formulas if it includes adding, subtracting, dividing, or multiplying columns together?

To clarify the previous response a bit more, the structuring of IFstatements is important. Keep in mind the structure of the function: =IF(logical test, value if true, value if false). So, the second IF function (the first nested) needs to be placed where the first "value if false" comes in - each additional IF needs to be within the previous IF function. Using your example, the corrected form would be =IF(W4=Q4,V4,IF(W4<Q4,Q4*V4...)). I'm not sure what the "+X4" is supposed to be adding to, but this hopefully makes the structure clearer for you to work with. Good luck!

Related

How to Subtract a value from the oldest expiration date and move to the next once it hits zero?

I work for an organization and I am working on a way to better organize our part numbers that have expiration dates. I've started off by making an Excel sheet that has the part number multiple times based on the expiration date and then had the matching quantities of that expiration date. What im trying to do is what you always do in life, if something is going to go bad use up the one that will expire first. But now trying to do this in an excel table automatically. This is my Ex: my master log where they will put in the Part#, expiration date, and quantity, this is where most info will be pulled from.
I am now on to taking away our companies forecasted usage of these parts away from these quantities to show an overall usage over the months and pairing the intersecting expiration dates. I’ve got the Usage by using a pivot table to total these part numbers quantities. And I’ve made a chart mapping the overall usage to part quantity forecast with it being flagged if the expiration date interferes with the actual date. This is the forcasting for what we plan to use of each part #
This is me subtracting the usage number from the inventory of those part numbers and it being flagged when it expires.
=IF((IF((VLOOKUP($F60,Expires!$1:$1048576, 10, FALSE))<Sheet1!G$58, "Bad", "Good"))="good", T33, "Expired")
I used this function, my vlookup pulling from my first sheet and pulling the part numbers expiration date and if it is <the date up top (9/1,10/1 etc.) then it will be flagged as expired and wont even show the usage. T33 is simply pulling the fromual from another table which is just quantity- usage. Please lmk if this looks right my vlookup turns out pulls the latest expiration date from the multiple part #s.
But that is with total quantities, not separated based on the part number expiration dates. What I am wondering is how can I make a table like this but subtracts the usage from quantity of the part number that will expire first? Then after that quantity hits zero it takes away the usage from the next one due to expire? But also I want the Numbers to be able to auto populate from the sheet where the user enters the data (master log).
So this is what it will be doing and will look like the table above multiple of the same part number. Whats happening now
But needs to look like this Final table and add the part number to the list and quantity as they are entered in the master log. I was trying to do a Vlookup(MIN and take the part number from the other table based on the lowest expiration date first but I don’t think excel is capable of that, I’m not sure here.
Please help, thank you!

Using Sumproduct to calculate two tables using horizontal (table headers) and vertical references

Hopefully the title makes some sense because I'm trying to wrap my head around the logic and I'm not quite sure how to phrase the question.I'll try to give a brief explanation of the end goal without over complicating it with unnecessary details.
I have a table of survey score averages for every month per person and a correlating table with the number of surveys each person received for each month. The logic is essentially multiple the score for each month by the number of surveys, combine them, divide by the total number of surveys within that time period to get their true average. Where things get a little complicated is that I have to include the ability to set a custom date range and return the value. So sometimes I might be looking at the average for Jan - Apr, other times I might just be looking at Feb-Mar etc.
I think sumproduct is going to get what I need done but I'm running into issues trying to write it out. I've written it several different ways and none of them worked so here's one that best conveys what I'm trying to do,
=SUMPRODUCT(--(F7:I7,L7:O7>=C2),--(F7:I7,L7:O7<=C3),--(E8:E12,K8:K12=B9),tbl_average[[Jan-20]:[Apr-20]],tbl_surveys[[Jan-20]:[Apr-20]])
I super appreciate any assistance I can get on this. I'm hoping the end result is not nearly as difficult as I'm making it out to be.
Some additional information:
I'm going to be using this same process to calculate multiple metrics across multiple worksheets.In the test example each of the tables will most likely be on different sheets. The dashboard with the calculated results will contain everyone's names and will be filtered and rearranged frequently, so I need to make sure we're always matching directly to their names and not just the relative rows. Basically, in my example I show that Agent 1 is always lined up on row 8 but that's not always going to be the case. Agent 1 could be in Row 8 on Sheet 1, Row 10 on Sheet 2, and Row 12 on Sheet 3 and I need all the correct values to multiply and sum against one another.

Index Match Match across multiple columns

I have an Index Match Match question that I have not been able to find the answer for in researching. Although the solution may actually might be different than an Index Match Match formula - I'm open to try something more efficient than my current workaround.
I have one worksheet with data from my company on it. We sell a Product (let's call it Coke Zero) and we track the weeks that we put a promotion on and how much profit we make by selling it to the retailer. For example a promotion for Coke Zero starts the first week of Jan and ends 3 weeks later and we make a gross profit of $100 each week the promotion runs. I then have an external database with sales data formatted on a weekly basis to tell me how many units of Coke Zero I sold in each week. My internal data has thousands of lines like this with dozens of products, however the promotions are consolidated on one single row regardless of if it runs for more than one week, making matching up to the external database difficult. I need to create a lookup for what our Gross Profit was for each week of the promotion.
I have attached an example image of the workbook + two data sheets of what I've tried to do, summarised below.
On the Internal Data Sheet I've created additional columns to the right with all of the weeks listed that the promotion is on for, and concatenated them with the Product Code to be able to match week by week to the data in the External data sheet. Then my lookup basically checks every column one after another until it finds one where the concatenate of Week_Product Code concatenate matches.
My current solution technically works but my final formula is really slow and cumbersome given the data can be anywhere from 10K-200K lines when looking at multiple retailers. I was hoping to find a more efficient formula to complete the lookup.
Current solution on the External Data Sheet Column E:
=IF(ISNUMBER(MATCH(D2,'Internal Data'!$E:$E,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$E:$E,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$F:$F,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$F:$F,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$G:$G,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$G:$G,0)),
"0")))
I got SUMPRODUCT to work using this formula in J2:
=SUMPRODUCT(--($B$2:$D$3=H2)*--($E$2:$E$3=I2)*$F$2:$F$3)
And, you don't need those concatenated lookup columns:
Well, that was fun.

Dynamic Sales Summary Depending on Month (can't use MAXIF/MINIF)

I have a student license of Office Pro 2016, but somehow it doesn't have the IFS, MINIF/MINIFS, MAXIF/MAXIFS functions that would make my life so much easier. I tried to illustrate what I'm doing in the image below:
Example
My actual data is much more complicated and long, but the idea is that I will periodically manually update data within the DATATABLE, and I want the SUMMARYTABLE to reflect the total pending sales by month. There are never more than two months pending at a time, and if only sales from one particular month are pending, I don't want the second row to appear.
I've already found a way to display the month in this case using regular MAX and MIN functions, but now I'm stumped as to how to display the sum total of sales within those months. Specifically, I don't know how to make a reference to a particular month in my criteria.
I've tried this formula:
=SUMIFS(DATATABLE[SALES],DATATABLE[SHOP]="A",DATATABLE[STATUS]="PENDING",MONTH(DATATABLE[DATE]),SHOPATOTALS[MONTH])
If this worked it would have been perfect, but the month portion isn't recognized as a proper range.

find average of calculated field in cognos 10.1

I have a calculated field a/b which makes sense at week level, where a is last of period metric and b is sum of the period metric. I need to find avg(a/b) for the weeks that fall under a month and not end_of_month(a)/sum(b) for the month. I made my a/b metric with regular aggregate as calculated and then monthly average metric with regular aggregate as average, but it doesn't work. The report is a crosstab report. How can I solve this?
Edit: a is end on hand inventory, b is sales, a/b is weeks of supply. Both a and b spread along product/location/time dimensions. For a, I've set its regular aggregate for time as last.
Your form of expression gives me error, so, I tried average((total([a] for [week]))/(total([b] for [week]))) which is error-free but doesn't give correct result. I used total[a] because it still has to sum along other dimensions except time. Any ideas?
I was also trying an alternative way- get the individual weeks of supply and then derive a new metric as (first week wos + ...+fifth week wos)/5. But I get a warning when I try to put a case statement as "Relational query objects are being used in conjunction with Dimensionally-modeled relational objects", and the metric give garbage value. How can I apply case involving relational item in query items of measure dimension?
You have to be more clearer on what you are trying to achieve.
Also, the header says framework manager, while you are talking about report.
My best guess is you need to use the for expression in your aggregate the values:
avg((max([a] for [week]))/(sum([b] for [week])))
You might need to use other (more sophisticated) summary function
for more details about the FOR and AT look here:
Using the AT and FOR Options with Relational Summary Functions

Resources