Excel SUMIF Offset - excel

I have a spreadsheet that is used for inventory planning. It has, in columns, 5 weeks (per month) followed by a month total, then another 5 weeks, followed by another month total, and so on for 12 months. Each week column is labelled "Wk 1", "Wk 2" and so on. Each Month is labelled as "Jan", "Feb" and so on.
I have the product code at cell A2, and a lead time (in weeks) at cell C2. The lead time varies by product.
Column B is the first column with data (column A is used for labels).
On row 5 there is opening stock on hand.
On row 6 there is the sales forecast.
On row 7 there are Purchase Orders received.
On row 8 is closing stock on hand.
Row 10 is a staging area. This is my problem row. These are my planned orders.
My cell B10 formula is =SUM(B6:OFFSET(B6,0,C2-1)). My planned purchase order = planned sales for the next x weeks, so I need to exclude the month columns.
The result should be as shown in cell B11. Formula for that cell is =SUM(B6:F6)+SUM(H6:K6)+SUM(N6:R6). Note that cell L6 is excluded.
Not sure how to increase the number of columns to include in the offset as a lead time may be 26 weeks, so there could be a few "month" columns I need to exclude, and then how to exclude the monthly totals?
I'm thinking maybe using a Sumif combined with Offset, but I am scratching my head.
Your help will be much appreciated.
Image of Excel file showing structure
Havent tried anything, as am unsure what to try.

see attached photo for your answer.
The formula you seek for cell B10 is:
=SUMIFS(OFFSET(B6,0,0,1,C2+(COUNTA(B4:ZZ4)-COUNTIF(B4:ZZ4,"wk*")+COUNTIF(B3:ZZ3,"exclude"))),OFFSET(B4,0,0,1,C2+(COUNTA(B4:ZZ4)-COUNTIF(B4:ZZ4,"wk*")+COUNTIF(B3:ZZ3,"exclude"))),"=wk*")
Solution

Related

how to count all the entries put under a row having specific days of a month

In this Sheet:
How to count all the entries (Text or Numbers) under A1 to AD1 (based on days only from Sun to Thu.) except Fri and Sat.
Note: if month is changed from list thus all the dates and days will be changed. Counting done as per changed month
Note: if month is changed from list thus all the dates and days will be changed. Counting done as per changed month
Given there are two rows at the top of the sheet, I am going to assume you want to check the contents of A3:AD3 against the day of the week in row A1:AD1
My simple answer is this formula at the end of each row (cell AF3, for example)
=COUNTIFS(A3:AD3,"=*",A1:AD1,"Sunday")+COUNTIFS(A3:AD3,">0",A1:AD1,"Sunday")+
COUNTIFS(A3:AD3,"=*",A1:AD1,"Monday")+COUNTIFS(A3:AD3,">0",A1:AD1,"Monday")+
...
You could also create a hidden helper row (let's call it AD2) that operates on the date row using the WEEKDAY() function, which will generate a number between 1 an 7 for the day of the week starting with Sunday. In this implementation, you would only need the following:
=COUNTIFS(A3:AD3,"=*",A2:AD2,"<6")+COUNTIFS(A3:AD3,">0",A2:AD2,"<6")
Another solution would be to copy/paste a similar formula across the columns at the top of the sheet (row1, for example), as follows:
=IF(WEEKDAY(A2)<6,COUNTIF(A3:A32768,"=*")+COUNTIF(A3:A32768,">0"),"")
This assumes your date is in row2 and the data entries start in row3. As rows are added to the sheet the formula will work without requiring any action. In this example I used 32768 for the max number of rows but this is arbitrary.
To get the overall total you would sum the across the columns of row1, such as SUM(1:1) or sum (A1:ZZ1) depending on the number of columns you have.

Formula for SUMing certain months but disregard blank cells

I'm trying to total sales amount in a column for a certain month. The column with the dates will include blank cells.
I got this code to work once but when I try to change the sheet it references it just comes up with $0.
=IF(ISBLANK(eBay!$A$2:$A$3000),0,(SUMPRODUCT((MONTH(eBay!$A$2:$A$3000)=1)*eBay!$H$2:$H$3000)))
Where the Month Column is eBay!A2:A3000 and the sales column is eBay!H2:H3000.
I've also tried:
=SUMIFS:(eBay!H2:H3000, eBay!A2:A3000, (MONTH(eBay!A2:A3000)=1, eBay!A2:A3000, "<>")
I tried the Evaluate Formula for the first formula and it comes up as TRUE for ISBLANK when there are two cells with dates in them.
The second formula says the MONTH is 4 when there is a Month for January. So I changed the date from 1 to 4 and it didn't total for April either.
I thought either one of these formulas would work. What can I try next?

N-Count Days For Changing Dates For Ecommerce Shipment Sheet

I have to submit a daily MIS for orders which are Undelivered For less then 2 Days, Undelivered Between 3-5 Days and 5+ Days.
Currently i'm doing this manually by counting from the Purchase Date forward. So e.g. for an order of 11th March, i'll just count 2 days till 13th (If undelivered) and type 1 in front of the column and do a count manually of all orders outstanding in each column.
The problem arises as the column descends and the dates get further and further away from current day.
This is tiresome but i can't seem to find an algorithm that can do this automatically.
Can anyone help please.
Consider this screenshot:
Cell A1 has the date you want to compare to. Don't user the Today() function, since it is volatile and can slow down the workbook. Just manually put in the desired date.
The formula in cell E2 is
=IF(D2="undelivered",IF($A$1-C2<=2,"less than 2",IF($A$1-C2<=5,"3 - 5 days","5+ days")),"")
In words: if the status is "undelivered", calculate the difference between purchase date and A1. If it is less than 2, return that text, if it is less than 5, return that text, otherwise return the third text.
Copy that formula down.
In cells G3 to G5 you see each of the three texts and next to it is a formula. Starting in H3
=COUNTIF(E:E,G3)
copied down to H5.
Your layout may differ, so you will need to adjust the formulas accordingly.

Return value of last non blank cell in 3D range

I'm working on a workbook that tracks monthly numbers, and also provides a yearly and quarterly summary for those months. The workbook has a Fiscal Year sheet, four quarterly sheets (named Q1-Q4), and 12 sheets for the months (Jul, Aug, Sep, Oct, etc). All of sheets in this workbook look identical.
Completing most of the Fiscal Year sheet is fairly simple, just use the formula =SUM(Jul:Jun!B3), which looks at all 12 monthly sheets and sums cell "B3". No problems there.
However, we have a backlog section that shows how far behind we are. For this number on the Fiscal Year sheet, I just want the number from the latest month of data. Since it's not a cumulative sum of all the months before, it's causing me issues.
I need a formula that will find the last non-blank cell in those 12 monthly sheets (they are in fiscal year order), and return just that cells value. The range for that formula would be Jul:Jun!B17. So if March is the last months worth of data, and the backlog number for march is 56, I want 56 to show on my Fiscal Year sheet.
I tried using
=LOOKUP(2,1/('Jul:Jun'!B17<>""),B17)
But it becomes this
=LOOKUP(2,1/('Jul:[June]June'!B17<>""),B17)
And returns a #REF! error. Any ideas?
Thanks!
If I interpret your question correctly, then the following Array formula will give you what you seek: =INDEX(A1:A16,MAX(IF(ISNUMBER(A1:A16),ROW(A1:A16),""))).This can be put in A17 for July and copied across the row to L17 for June.
Ahhh,I see.The following formula is a bit cumbersome, but solves what you are trying to accomplish.I would imagine that using VBA would be more direct and simpler, but in your example of effort you used formulas so I take it that you prefer a formulaic answer :
=CHOOSE(MAX(IF(Sheet1!B17>0,1,0),IF(Sheet2!B17>0,2,0),IF(Sheet3!B17>0,3,0),IF(Sheet4!B17>0,4,0),IF(Sheet5!B17>0,5,0),IF(Sheet6!B17>0,6,0),IF(Sheet7!B17>0,7,0),IF(Sheet8!B17>0,8,0),IF(Sheet9!B17>0,9,0),IF(Sheet10!B17>0,10,0),IF(Sheet11!B17>0,11,0),IF(Sheet12!B17>0,12,0)),Sheet1!B17,Sheet2!B17,Sheet3!B17,Sheet4!B17,Sheet5!B17,Sheet6!B17,Sheet7!B17,Sheet8!B17,Sheet9!B17,Sheet10!B17,Sheet11!B17,Sheet12!B17)

Calculating Year-To-Date Accuracy removing predicted forecasts

I have an Excel spreadsheet and looking to add what I think will be a simple formula.
The calculation I am looking for is to calculate the Actual Year-to-Date (YTD) percentage of delivery performance.
Currently the YTD calculation takes the sum of cells B13:G13 (Bulks Accurate) divided by the sum of cells B4:G4 (No of Bulks Due per week). This doesn't show an accurate YTD as it also includes the forecasted number of bulks due in weeks 5 and 6. I am looking for a formula that will include a statement to say if the yellow cells in row 6 are not completed then the YTD calculation will not include the forecasted bulks due in row 4.
Thanks for your help in advance!
YTD Spreadsheet Image
Could you change the logic of row 11 (No of Bulks) to show the value in row 4, but only if row 6 AND 7 are blank? An IF AND formula would suffice, entered in B11 and then copied across:
=IF(AND(B6="",B7=""),0,B4)
Then, your YTD formula can be simply
=SUM(B13:G13)/SUM(B11:G11)
This way, even if no delivery has taken place when due, you enter "0" and the % will then include that week's due figure in the overall calculation.
1st Example Spreadsheet Img
If you can't change row 11 because it needs to match row 4, then you could insert a new row to implement the IF AND formula and amend my YTD formula above to use the new row instead of row 11.
If you can't add to the structure of your table at all, then you can still achieve the same result by using a SUMIFS as your divisor, as below:
=SUM(B13:G13)/SUMIFS(B4:G4,B6:G6,">=0",B7:G7,">=0")
The only difference with the SUMIFS route, is both the row 6 and row 7 values must be set as at least 0 for it to include row 4's value. The first route means row 4's value is included as soon as row 6 OR row 7 have a value entered.
2nd Example Spreadsheet Img

Resources