Combine date range in column A row 3 though 9 and repeat every 7 rows - excel

I have an excel sheet where I need to take an average cost of 7 days. I have two columns, one with a date and the other with a charge. See the attached screenshot for reference and output. The formula I'm using for charges works as expected in column d. I need to find a way to add the date range in column c. Please advise
Date: Need help here - Column c should repeat, and the next cell should have 2022-08-02 and 2022-14-02. The current formula starts on 2022-02-02 if I drag the cell.

Try below formula to google-sheet.
=INDEX(TEXT(A2+SEQUENCE(10,1,0,7),"yyyy-dd-mm") & " " & TEXT(A2+SEQUENCE(10,1,6,7),"yyyy-dd-mm"))
For Excel-365 no need INDEX().
=TEXT(A2+SEQUENCE(10,1,0,7),"yyyy-dd-mm") & " " & TEXT(A2+SEQUENCE(10,1,6,7),"yyyy-dd-mm")

Related

I need to retrieve the date from the row that will deplete my inventory

This is hard to explain...
I have a report that I pull from our MRP system that gives me a Due-Date, a quantity required, and an item number. There will usually be several rows with the same item number each representing a different sales order.
I have another report that gives me the on hand quantity for each item. In this report, each item is listed only once.
I need to get the Due-Date that corresponds to the row that will use up the last of my inventory. (Inv. runout)
Due-Date
QTY-REQ
ITEM
4/27/21
5
C
4/28/21
7
A
4/29/21
5
B
4/30/21
1
B
5/1/21
13
A
5/2/21
4
A
5/3/21
12
C
5/4/21
1
A
OHQ
ITEM
INV. RUNOUT
10
A
formula here, Result should be 5/1/21
5
B
result should be 4/30/21
10
C
result should be 5/3/21
I hope this makes sense, if not, please let me know what I can answer to help with this.
-Nick
You'll need a new column on the first report using IF(SUMIFS( to only show the date of lines where the stock runs out at or before that date. Then in the second report, use MINIFS(), a fairly new function, to find the earliest date in that column that matches each product.
In the below example I'm assuming that both of the above reports shown are columns A B and C, in the same excel file, on sheets called Report1 and Report2.
In cell Z2 on Report1, enter the formula IF(SUMIFS(B:B, A:A, "<=" & A2, C:C, C2) > INDEX(Report2!A:A,MATCH(Report1!C2,Report2!B:B,0)), A2, "") and copy down for all rows. This will only display the date where the stock has run out by that date.
In cell C2 on Report2, enter the formula =MINIFS(Report1!Z:Z, Report1!C:C, Report2!B2) to get the earliest relevant date displayed from the formula above.

COUNTIFS for dates within last 12 months

I'm trying to count the number of dates in a range that fall within the last 12 months. The formula I have now counts YTD. Anyone know how i can adjust the formula to count the last 12 months?
=COUNTIFS(O19:O500,"*",L19:L500,B7,P19:P500,">43831")
Both of the following formulas work:
=COUNTIFS(O19:O500,"*",L19:L500,B7,P19:P500,">" & Today()-365))
=COUNTIFS(O19:O500,"*",L19:L500,B7,P19:P500,">" & edate(today(),-12))

excel counting + matching 3 columns

I have a log where I have two columns (H&G) where I have sales people's names inputted for each row. Column I lists the row as belonging to one of three categories ("name1" "name2" or "name3").
On the next sheet in the book I have tabulations for counting how many times each person's name appears, but what I'd like to do is cross reference that with how many they appear next to each of the categories.
ie I currently can tell that Steve has 6 deals. But what I'd like to know is that Steve has 4 of name1 and 1 each of name2
edit:
So I think I've not been clear on what I'm searching for: I am trying to sum the number of times a salesperson's name appears in columns F or G that also have a string in column H.
ie: Steve's name appears 13 times, but only 8 of those are on rows that have Phone
Assuming your data is as in the image below, try following formula
=COUNTIFS($F2:$F9,J2,$H2:$H9,K2)+COUNTIFS($G2:$G9,J2,$H2:$H9,K2)
Drag/Copy down formula as required and change range as per your data.
In above formula I am assuming you want to consider Column F and column G separately for category. In case you want both Column H & G to have same name for category then use
=COUNTIFS($F2:$F9,J2,$G2:$G9,J2,$H2:$H9,K2)
This will give result 1 as only Row 5 has Steve in both Column F & G matching category Phone.
EDIT : As per #ForwardEd's comment
If you want to count row having same Name in both Column F & G only once (as in Row 5 in image), then subtract above two formulas as
=COUNTIFS($F2:$F9,J2,$H2:$H9,K2)+COUNTIFS($G2:$G9,J2,$H2:$H9,K2)-COUNTIFS($F2:$F9,J2,$G2:$G9,J2,$H2:$H9,K2)
or use
=SUMPRODUCT((($F$2:$F$9=J2)+($G$2:$G$9=J2)>0)*($H$2:$H$9=K2))
This will give result 3 for Name=Steve and Category=Phone considering Rows 2,5,8 (note : Row 5 has Steve in both Column F & G but will be counted once).
Use COUNTIFS:
=COUNTIFS(A1:A6,"steve",B1:B6,"name1")
For referencing from multiple sheets:
=COUNTIFS(A1:A6, "steve", Sheet2!A1:A6, "name1")
you can make n columns for each column you'd like to know and or you can make a single big column with multiple formulas.
You can use the & symbol to string together a long formula in a single cell.
Like:
="Month 1: "& countif(G1:G10,"Steve") & " " & "Month 2: "& countif(H1:H10,"Steve")
All that will output: Month 1: 4 Month 2: 2
you can string a lot of functions with the & symbol, so you can change the placeholder and stuff.
Also you can change the inquote string "Steve", for a reference so you'll just have to write this big formula once.

Formula's with year and weeknumber

I want to create a SUMIFS formula with a date criteria. The whole report is based on years and weeknumers and I like to keep it that way without converting these to dates. The data is set up as following:
Col A Col B Col C Col D
YEAR Weeknumber Turnover ColA & ColB
I want to create a MAT turnover number based on the report week and year. I tried to merge colums A & B to get YYYYWW but since the first 9 weeks are only one digit the formula does not work.
note Cel F1 contains the report year and Cel F2 contains the report week
The sumif formula is the folowing:
=SUMIFS(C:C;D:D;"<="&F1&F2;D:D;">="&(F1-1)&F2)
Anyone got any idea how I can make this work?
So your column D formula:
=--(A1&TEXT(B1,"00"))
Your other formula:
=SUMIFS(C:C,D:D,"<=" & --(F1 & TEXT(F2,"00")),D:D,">=" & --(F1-1 & TEXT(F2,"00")))
If you want to do it all with one formula then:
=SUM(IF(( --(F1 & TEXT(F2,"00"))>=--(A:A &TEXT(B:B,"00")))*( --(F1-1 & TEXT(F2,"00"))<=--(A:A &TEXT(B:B,"00"))),C:C))
This is an array formula and needs to be confirmed with Ctrl-Shift-Enter when leaving edit mode.
This is slow as it is written. It would be best if all the full column references were truncated to just the extreme absolute data limit. As in A:A to $A$1:$A$10000. This will speed up the array formula.

Summarize hours using 2 criteria

I wish to add a summary sheet to a workbook that captures timesheet data.
The timesheet sheets are laid-out like the screenshot below, where each row represents a day, and then a person's total hours worked are distributed across columns C to E, which are identified by a unique combination of seg2 and seg3 codes:
So, for the first column (C) has a unique combination of 201 & 303, which totals 19.9 hours, then (D) has a unique combination of 201 & 301 which totals 5.9 hours and then (E) has a unique combination of 202 & 303 which totals 11.2 hours.
My summary sheet will look like the screenshot below; where every possible combination of seg2 and seg3 codes are listed:
What I'm looking for is a formula on the summary sheet against the "January Hours" column that will take the combination of Seg2 and Seg3 codes for its row...
Then compare that with the range of cells in the timesheet sheet that has the Seg2 and Seg3 codes used:
Where it finds a match...
I want it to return the SUM of the range of hours below it...
...returning the total number of hours for that unique Seg2 and Seg3 combination:
I'll then drag the fill handle to finish all the formulas for the Summary sheet's "January Hours" column.
I've managed to do this using a single seg code using SUMPRODUCT, but have not yet figured out how to do it for 2 criteria (i.e. 2 seg codes).
By leaving the row parameter of the INDEX function empty, you can lookup an entire column. See the below formula and enter with CTRL + SHIFT + ENTER
=SUM(INDEX($C$4:$E$8,,MATCH($G2,IF($H2=$C$2:$E$2,$C$1:$E$1),0)))
Please note that this formula sums up all the values in the table as suggested in your example, and not just the values with a date of 1/1/2015.
INDEX/MATCH can handle a 2-way match -- is it necessary to "re-sum" the hours? If the Seg2/Seg3 Totals from the time sheets are always in the same place, this will look up the total hours:
=INDEX(Timesheet!$C$2:$E$10,9,MATCH($A2&$B2,Timesheet!$C$2:$E$2&$C$3:$C$3,0))
Edit: forgot to note this is an array formula

Resources