I want to ask:
How to use looping switch statements in a C++ program?
Like a company sells 3-4 products and we have to enter a price for each product in that program. And the user can also enter the quantity.
Then that program calculates the price * quantity as well as it includes GST in the end.
Related
Over the past couple of days, I've had a hard time figuring out an issue that is supposed to be easy but I just can't wrap my head around.
To add some context, here's what I'm trying to do: I'm working on a class attendance sheet for teachers to keep track of students' attendance. In order to submit an entry, teachers will have to fill in 4 different cells: Date, Time, Lesson Content and Status (whether the class took place or the student didn't show up). I've added a dropdown to the Status cell so that the teacher chooses between predetermined codes (more on that soon).
I've also included a separate sheet where the school will register eventual replacement classes set up in alternative schedules, and it works in a similar fashion to the overall attendance sheet.
The third and last sheet in this workbook (where I'm having some issues) is an Hour Bank that is calculated based on the amount of cancellations versus the replacement classes the student scheduled and attended.
Here's where the issue kicks in. As I mentioned, I would like to create an Hour Bank System in order to store the classes that are "replaceable". This would be a relatively simple task, the only issue is that I also need to establish a cap (which is 8) so that the Hour Bank will not add beyond this specific number. The Hour Bank works fine, but the number doesn't go down immediately if the student exceeds the cap. If the student has, for instance, 2 classes over the cap, the Hour Bank Balance only goes down to 7 if I enter two replacement classes. However, I would like this particular cell to cap at 8 and go down as soon as a replacement class is registered, regardless of how many hours the student exceeds this cap.
Here are the elements contained in the 3rd sheet:
-Total Classes Given (D8): This part works fine. It's just a SUMIF with the specific code that means "Class ok". Code below:
=SUMIF(FREQ!F9:F106;"AR";FREQ!G9:G106)
-Total Client Cancellations (D11): This part also works fine. It's another SUMIF with the specific code meaning that the student didn't show up to class and didn't notify the school. These classes won't be accounted for in the hour bank. Code below:
=SUMIF(FREQ!F9:F106;"AC (Aluno)";FREQ!G9:G106)
-Total Replaceable Classes (D14): This part works fine. It's a combination of two SUMIFs with the codes that mean "Ok, student didn't come but we'll let them schedule a replacement class". Code below:
=SUMIF(FREQ!F9:F106;"PP";FREQ!G12:G109) + SUMIF(FREQ!F9:F106;"AC (Miles)";FREQ!G12:G109)
-Attendance Rate (D17): This part also works fine. It just shows the percentage of the classes that the student has attended up until the present moment. Code below:
=IF(D8>0; D8/FREQ!G107; "0,00%")
-Pending Replacement Classes (G8): This part works fine. It is a simple subtraction that calculates how many classes are pending (not considering the cap). This number goes down as I enter replacement classes in the second sheet of the workbook, and goes up as the teacher registers replaceable cancellations in the first sheet. Code below:
=D14-G11
-Given Replacement Classes (G11): This part works fine. It is a SUMIF that keeps track of how many replacement classes were given in total. Code:
=SUMIF(REPO!F9:F106;"AR";REPO!G9:G106)
-Exceding Hours (G14): This cell is broken. I'd like it to compute the amount of hours that the student has cancelled over the established cap. It does work when it comes to only computing the hours over the cap, but the issue is that it decreases as I enter replacement classes in the 2nd sheet of the workbook instead of subtracting them from the Hour Bank Balance which I will explain below.
=IF(G17=8; G8-8; 0)
-Hour Bank Balance (G17): This cell is broken, and it's the most important part of the entire workbook. I would like it to compute the replaceable classes up until the cap (which is 8) and make it go down immediately as a replacement class is registered. However, if the student has Exceding Hours (G14), the replacement classes are substracted from G14 instead of G17, which is what I wanted. The Hour Bank Balance (G17) will only go down if the Exceding Hours (G14) equals zero. Here's the code:
=IF((D14-G11)>8; 8; D14-G11)
I hope I was clear enough and I'm willing to provide screenshots if need be. I'm sure there's a problem with my maths or something, but I've been unable to spot it.
Please help a brother out!
Thanks in advance
I think that this formula might be what you’re looking for:
=IF((D14 - G11) > 8, 8, IF(D14 > 8, 8, D14) - G11)
The first part of this formula would give 8 as a value if D14 - G11 is greater than 8; the second part of this formula yields D14 - G11 except for in cases where D14 is greater than 8, then it gives 8 - G11. Hopefully this is what you were looking for.
I am making a sheet to CALCULATE REAL REVENUE from each sale I make on my online store.
The problem is that the COST of my products is not always constant. It varies depending on many factors so each time I make a purchase I add the NEW PRODUCTS COST (LATEST COST).
Each time I make a new purchase I will add the QUANTITY and the new COST. (PURCHASE 1, PURCHASE 2, PURCHASE 3,etc).
Screenshoot of my sheet with example on ROW 41
In Column B I want to know which is the CURRENT COST based on the amount of TOTAL SALES of each product.
For example:
If I have sold less than 100 ( Pruchase 1 QUANTITY) then I need the formula to choose value of E41 (PURCHASE 1 COST).
If I have sold MORE than 100 and LESS than 300 (which is the SUM of PURCHASE 1 & PURCHASE 2) I need the formula to choose value of G41 (PURCHASE 2 COST) AND SO ON...
The formula I have come up with so far is this:
=INDEX(41:41,,IF(C41<=D41,COLUMN(E41),IF(C41<=D41+F41,COLUMN(E41)+2,IF(C41<=D41+F41+H41,COLUMN(E41)+4,COLUMN(E41)+6))))
This formula WORKS but only for the first 3 PURCHASES.
I need a formula that has no limit but I don't know how to make a VARIABLE formula.
Please take my words literally when I say that I wouldn't waste one minute on trying to solve your problem with your current sheet design. You would need VBA, and then extract quantities and prices from each purchase without the ability to filter on columns. (Minute is up.)
What you need is a Purchase database: ItemID, Date, Quantity, Price, maybe Ref#. From that you can pull out the transactions for any item by filtering on the item and the cost by using functions like SUMIF. However, this just brings the real problem within reach without solving it.
The problem is that when you buy 100 pcs #42 your price is 42. Then you buy another 100 pieces #46 your average price is 44. But if you sold 50 pieces with a cost of 42 then the average cost of the remaining 150 is 45. Therefore you can't determine the average cost of any remainder without knowing the quantity sold and the average cost applied to that sale. To solve that problem you will still need VBA but the suggested db format of purchase record would at least support such a solution.
Not so long ago I programmed a solution where there were additional columns in the db and each sale was recorded in 3 columns (much like your present purchase record): date, Qty, Ref. In this way I could trace the sale of each individual purchase (this was for shares trading). The sale of the newer quantity wouldn't start until the earlier quantity was sold out.
Perhaps you don't need to trace where the purchased quantity went to and just need one column to count down the balance to zero. That would be much simpler but has the drawback that you can't roll back errors. In the end the rollback was the reason why I abandoned the design. The key to the ability to abandon it is a similar db for sales: date, qty, price, Ref#.
With such a setup you might design a system to either extract the average or FiFo price from the purchase side and associate it with a sale. If the condition is that it should be done with worksheet functions you could add a column for "current cost" in the purchase db, changing with each purchase, which you look up by date from the sales side using VLOOKUP or SUMPRODUCT, having set a cost price applicable from the day of purchase until the next. If that appeals to you, a method must be found to deal with days on which there are both purchases and sales.
I have no programming experience, yet I am in a desperate need for a help. I am managing a large restaurant/catering company where i once a month have to make an inventory of more than 1.000 products. I have an excell sheets, that are devided into a categories, for example for the kitchen, there is Fruits And Vegetables, Dairy, Frozen, Fresh Meat etc.
It is really hard, to go around using a laptop and do the inventory of more than a 1.000 items manually, so i was thinking, since I actually have a barcode scanner, if there is a possibility to just go around, and scan the products, after scanning a products barcode, excell would take me to the row of the products that corresponds to the scanned barcode.
Right now, if i scan the barcode with a scanner while in excell, it will just add the scanned value to what ever field i am in currently. so the scanner works, all i need is to capture that scan, compare it to the all barcodes that are associated with products, so it could take me to the QTY field of that particular product.
For example, if i scan a Star Anis product with barcode 23135165, the excell should find that product, which is as per picture in field B6, and than take me to the field F6, which is where the quantity should be entered.
\So, in short, i scan a product that is in a dry storage, the excell finds a product within 6 different sheets via corresponding barcode, and takes me to the field where i can enter the quantity of that product :)
This would save me hours and hours of work :)
can this be done? Thank you :)
This is the picture of one of the sheets that i use when making and inventory.
What is the best way to export a list of the current discounts: percent, (price - if possible) and inventory id(s). We currently utilize 2 types of discounts:
Customer Price Class by item - Line - Percent and Quantity
Customer Price Class by item - Group - Percent and Quantity
To give some back story. We produce print catalogs. We would like to know the discounted price. It is helpful to know that the price we are displaying is correct. If finding the price is too complicated. The percent for the given quantity break would be enough (we have max of 3 break quantities). Entering these into a sales order or a quote is an option but we have 980 discount sequence ids.
Discount Codes
Thank you.
I have a GI that I believe will do that or get you close enough to finish...See if this result looks good for you
if so add these tables
[Add these relations]
relations
enter image description here
enter image description here
I hope this will help you...
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!