Add value until another cell value is reached - excel-formula

Could you please help me find a solution to a problem that i have in Excel? I don't know exactly if this could be achieved in Excel, so any ideea would be highly appreciated.
So, i have a very big production sheet.
- On column B i have the dates (in this format: 01.01.2019, 02.01.2019, 03.01.2019, etc);
- On column C i have the proposed production per day;
- On column D i have the current stock;
- On column E i have the medium request / day
Regarding the fact that the values on column E are changing depending on the client's request, sometimes will be bellow 10 days (out policy is to have a minimum 10 days stock). When this happends, i have to delete everything on column C and replan the production so the values in column E won't be bellow 10.
I was thinking about a formula in column C to do something like this: if E1<10, add 200 in c1. If after this e1 is still smaller than 10, add another 200.
The other problem is that our maximum production capacity / week is, let's say 2000 pcs (in column C), meaning a maximum of 400 pcs / day. So the formula should add 200, on 01.01.2019, then if column E is not 10, it should add another 200, but if column C is still not 10, the formula should go to 02.01.2019 and repeat the steps...
Also, if until the end of the week the value in column E is still not 10, it should repeat the steps begining from next monday (no production on saturday or sunday)
I attached a screenshot of my actual table (left) and another one with the desired result (right).
Is there any chance i can do something like this with a formula or it can only be achieved with VBA?
I really hope i made myself understood, english is not my native language and as i think you see, i'm not an excel expert...
Thank you so much in advance for any help or ideea you can give me.
\Cheers

Related

Sum Multiple Rows Sharing A Common Index Value

I can't seem to find any examples for this exact Index-Match function problem on this site.
The green boxes have the value of "x". What I'd like to achieve is to find every instance of "x" in column G (this will be dragged for all columns onwards), and essentially look-up in Column D for it's hours equivalent and sum them in a one cell calculation for each week.
e.g. in this section of the spreadsheet, it will sum: 3.75 + 7.5 + 3.75 + 15 = 30 hours
I started with: =INDEX($D$3:$D$157,MATCH("x",G3:G157,0)) which returns the right answer, i.e. 3.75 hours, so I attempted to loop the function using the following:
=AGGREGATE(9,0,INDEX($D$3:$D$157,,MATCH("x",G3:G157,0)))
Though this returns an #REF! error message.
This is a link to a screenshot of the spreadsheet for reference. (I don't have the necessary reputation to post the image with the question).
Any help on this problem would be appreciated. I would prefer an in-cell function solution, as I'm not confident with VBA.
G2: =SUMIF(G$3:G$157,"x",$D$3:$D$157)
and fill right as far as required.
It would be easier if you could add an hidden column with a formula "=IF(G7="x";D7;0)" and calculate the respective hours based on the presence of "x" in column G. Then you can just simply get the total for this hidden column. It is more readable and easy to maintain.

Detect running competition winner`s starting number in Excel

I have a task in in excel and I can`t think of the solution right now.
So I have a spreadsheet with running competition results: The table looks like this
So I need to detect which is the fastest runner that has ran all 3 laps (the winner) and detect the number(Nr) of the winner.
The F column is for calculations if needed
So I detected who had ran all 3 laps with this formula:
=IF(COUNT(C2:E2)>2;SUM(C2:E2);"DNF")
Then I determined who is the winner by running a min formula:
=MIN(F2:F79)
Now I need to detect what number the winner has, So it will be in the A column and in the same row where the row where =MIN(F2:F79) result is.
This is an task so manually finding it won`t work this time.
It is probably a really simple solution but I can`t think of it right now so it would be really nice if somebody could help out.
You can achieve this utilizing Index - Match.
The formula you would place in cell H2 would be as follows:
=Index($A$2:$F$79,MATCH($G$2,$F$2:$F$79,0),1)
What this does is it looks at the whole table and takes the Winner total time (cell G2) and matches it with the corresponding value in Column F, and then returns the first column (Column A).

Cumulative count that starts again when value in column changes (EXCEL)

I have 4 columns (although only need to know about 3):
Column A - An index that counts up from 1 and then resets to 1 after a certain period
Column B - A decision Boolean that is '1' for successful and '0' for rejected
The column I need help with is:
Column C - What I want is that whilst the index in Column A is counting up, for it to total up (cumulatively) the number of 1s in column B, but then reset when the index in Column A goes back to 1. I have manually started this, but would love a way of doing this automatically through a formula or VBA
Any ideas? I have hosted the data at the following link if anyone could help.
https://1drv.ms/x/s!Aqd9Lw8Wn3YHgeUPYjb7v5kIeWmq6A
Use this formula:
=SUM(INDEX(B:B,AGGREGATE(14,6,ROW($A$1:INDEX(A:A,ROW()))/($A$1:INDEX(A:A,ROW())=1),1)):INDEX(B:B,ROW()))
EDIT:
I was way overthinking the above formula use this much simpler formula:
=IF(A2=1,B2,C1+B2)

Complicated SUM formula

I'm having a nightmare trying to come up with a formula to solve the following issue. I have two columns 'Record Count' and 'Actual Hours', where record count is greater than 1 I need to sum the data in actual hours. If possible I only want to use one formula and the maximum record count that I can see is 5.
So if you check out the image below, for the rows where the are 5 records I want to see 15.75.
This would be the sum of 1.19, 1.75, 2.31, 3.5 and 7 as these all relate to a single client.
enter image description here
Looks like you want to get total time for each clientid. In that case it does not matter whether there is one or more records for the client. Assuming, clientid is column C and Actual hours column D, in B2 enter =SUMIF(C:C=C2, D:D). Copy all the way down.
Looks like a task for SUMIF():
=SUMIF(A:A,">1",B:B)
(assuming A:A is 'Recoud Count' column and B:B is 'Actual Hours')
This will get you the sum of hours where record cound is more than 1.
Starting from second record you can do partial sums. Here B is record count, C is client ID, D is actual hours. For second line (E2):
=IF(AND(B2>0,C2=C1),E1+D2,IF(C2>0,D2,0))
For A2:
=IF(C3=C2,"",E2)
It uses two formulas, requires to move whole table one row down and only places one entry against each client. If this is works for you - give it a try.
If you don't want to move data you can paste this formula in E2:
=IF(ROW(E2)==1,IF(B2>0,D2,IF(C2>0,D2,0)),IF(AND(B2>0,C2=C1),E1+D2,IF(C2>0,D2,0)))
If the row is first the rows above are ignored (avoiding nullPointerException). If the row is second or below it works does the comparison to see border of userid.

excel count/sum stop count/sum match?

I have tried to see if this question has been asked before, but I can't seem to find an answer.
I have a column of cells (>3000 rows), with either a value of 1 or 0 (call this column A). The value will depend on the value in column B (which will contain either a value or nothing). The values in column B are a SUMIFS function based, summing from column C, and based on months in column D.
The values in B are paid out on the first business day of the next month. So, the SUMIFS function will calculate the dates that match the last month. This works well in theory, however, not every first business day is the first day of the month. This leads the SUMIFS function to not include everything in the correct month, and allows for some discrepancy, which, when you are dealing with people's money is not great. Further, this discrepancy is compounded across multiple periods (in some cases, there are over 100 periods, and a discrepancy of $1 in period 1 amounts to nearly $1000 in period 100)
What I am wondering is:
Is there any way that I can tell the SUMIFS function (column B) to stop when the value in column A is 0? This would tell the SUM function start the summing from the current value in column B and continue the function to the cell below the preceding value in column B.
I've seen suggestions that the MATCH function may work, but I can't see how to do this with either COUNT or SUM.
For security reasons, this solution needs to be entered into the cell, and can't be VBA. Also, it can't be too large, as it will need to be replicated across 200 worksheets in the workbook (not my file originally, and I would have done it differently, but that is another story). There is no problem entering another column or two if that is required.
Any help is gratefully appreciated.
EDIT:
Unfortunately, I can't post an image of the screenshot. I've included a similar screenshot (columns are not the same layout, but hopefully it gives the idea) here:
Rates calculations
The SUMIF formula is (for B2)
=SUMIFS(C2:C35,D2:D35,D2-1,A2:A35,1)
This works fine if I want all the values in the month, irrelevant of when the payment was made.
However, what I need the formula to do is:
SUM (C2:C35,D2:D35,D2-1, but stop when the first 0 is encountered in A2:A35)
Thanks
The INDEX function can provide a valid cell reference to stop using a MATCH function to find an exact match on 0.
This formula is a bit of a guess as there was no sample data to reference but I believe I have understood your parameters.
=SUMIFS(C2:index(C2:C35, match(0, A2:A35, 0)), D2:index(D2:D35, match(0, A2:A35, 0)), D2-1)
This seems to be something that will stand-alone and not be filled down so I have left the cell addresses relative as per your sample(s).

Resources