Determine the range numeric scope from column - excel

I am using following SUMIF formula in sheet2:
=SUMIF(sheet1'!B1:B200,D7,'sheet1'!F1:F200)
There is a month in column A such as Jan from A1 to A200 and Feb from A201 to A300. I want to input Jan (Feb or any other) in some cell of sheet2 and then get its range, it is 1 to 200 in this case. Finally, this range will be used in SUMIF formula to get the result.
How can I do this?

=SUMIFS('sheet1'!F1:F200,sheet1'!B1:B200,D7,'sheet1'!A1:A200,"Jan") should work for Jan, or replace the hard coding for the month with a cell reference (E7?)
SUMIFS uses a different sequence from SUMIF (see for example).

Related

Sum based on dates on multiple column in Excel

1 st column date and 2nd column amount 3rd column date and 4th column amount .. is going on.
I want to sum based on date, If date between 2019 to 2020, i need sum the amount.
I was able to get the function SUMPRODUCT to work, assuming I understand what you want to do. (I think you want a billings total for each year, is that right?)
See this ExcelJet article on SUMPRODUCT.
There's probably a way to make this even shorter, but here's one solution:
See screen clip (I'm not allowed to post images yet.)
Formula for cell C6: =SUMPRODUCT(--(YEAR(B$3:B$4)=2019),C$3:C$4)
Copy that into cells E6, G6, I6, K6, and M6. The column references will adjust.
This will give you the 2019 totals for each of the 6 periods in row 6.
Formula for cell C7: =SUMPRODUCT(--(YEAR(B$3:B$4)=2020),C$3:C$4)
Copy that into cells E7, G7, I7, K7, and M7. The column references will adjust.
This will give you the 2020 totals for each of the 6 periods in row 7.
Formula for cell N6: =SUM(B6:M6). This is the 2019 total (the sum of row 6).
Formula for cell N7: =SUM(B7:M7). This is the 2020 total (the sum of row 7).

Sumproduct within date range

I'm using this formula to sum some data according to 4 criteria:
=SUMPRODUCT((Data!$A$2:$A$518=Sheet2!A2)*(Data!$D$2:$D$518=Sheet2!$E$1)*(Data!$E$1:$AW$1>=C2)*(Data!$E$1:$AW$1<=D2)*Data!$E$2:$AW$518).
The formula is set up so that the third and fourth criteria are used to identify a date range that is established in cells c2 and d2 of "Sheet 2".
When I evaluate the formula I notice it is not evaluating the date ranges as I would expect. Excel is assigning "TRUE" values to all the dates when executing the (Data!$E$1:$AW$1>=C2) segment and "FALSE" values to all dates when executing the (Data!$E$1:$AW$1<=D2) segment. There are dates in the data ranging from 2017 to 2020 and the current range I'm working with is December 2018 to November 2019, so the range is within the data.
This causing the formula to return 0 as the value.
The other sections of the formula appear to be working as expected.
I've checked my formatting and all relevant cells are formatted as dates.
Are there any other suggestions?
Thank you!

Count if a range of cells contains a certain month

I have a list that contains dates in M/DD/YYYY format.
In another sheet (see first image), i want to be able to calculate how many times a certain month appears in that list.
The formula i thought would work is
=COUNTIFS(*date range sheet&cells*,ISNUMBER(*date range sheet&cells*),*date range sheet&cells*,(MONTH(*date range sheet&cells*)=1))
In this case, the 1 would be for January, 2 for February and so on.
I am using a countifs because i have another if statement already worked out that i need to combine with this one: (*Date range sheet&another column*),"Loss")
Thank you all
With dates in column A, in C1 enter:
=SUMPRODUCT(--(MONTH($A$1:$A$27)=ROW()))
and copy down through C12:
C1 are the January countsC2 are the February countsetc.

Sumif Dates are equal or greater with exception

Hello I am working with a formula that adds a range of cells after comparing dates. For example range A1:A5 has random dates within the year 2017, range B1:B5 each contain the number 10, cell C3 contains the word "OFF". Range A6:A371 begins with 1/1/17 and ends with 12/31/17. I would like a formula that adds the 10 onwards beginning on the date mentioned in A1:A5 but not if it says "OFF" from that date onwards. The formula I have to add them is
=SUMIF(A7,">="&$A$1,$B$1)+SUMIF(A7,">="&$A$2,$B$2)+SUMIF(A7,">="&$A$3,$B$3)+SUMIF(A7,">="&$A$4,$B$4)+SUMIF(A7,">="&$A$5,$B$5)
Is there a better formula and how can I have it not include the date that has "OFF" in column C? I hope I have explained the problem and goal well, if not please ask me to clarify further.
In B6 put:
=SUMIFS($B$1:$B$5,$A$1:$A$5,"<=" & A6,$C$1:$C$5,"<>OFF")
Then copy down the dataset

Sum only matched values from two columns

Hello Everyone,
Does anyone know how to sum the Hours from column B (Hours) if column A numbers matched with column E and sum by months.
Example, take February data as an example, since only 3000 & 4000 existed in both column A & column E, that's why I need to sum the hours (20+10=30) from column B by it's month below.
I also attached the example excel sheet below.
https://www.dropbox.com/s/0s51g1i8g6s6e2d/Test.xls?m
Thanks in advance. :-)
You could get complicated with customer functions but if having an extra column (potentially hidden) doesn't matter then this would work:
In cell D2 enter:
=iferror(vlookup($A2,$E$2:$E$20,1,FALSE),"x")
Drag the formula down.
Under each month you can then put:
=sumifs($B$2:$B$16,$C$2:$C$16,B$22,$D$2:$D$16,"<>x")
Drag the formula across
This assumes you can change the month format in either column C or row 22 to be the same, ie. Jan, Feb, Mar or January, February, March etc.
Written on the fly and not tested so excuse any minor errors...
Both answers posted thus far are just fine, but just as an alternative, here's what I would do. Put this formula in cell D2 and drag it down:
=IF(NOT(ISNA(VLOOKUP(A2, $E$2:$E$20, 1, FALSE))), B2, "")
Then if you make a column containing the names of the months, say from G2 to G7 you have February, March, ..., July, you can put this formula into H2 and drag it down:
=SUMIFS($D$2:$D$16, $C$2:$C$16, G2)
That should get what you want.
Put this formula in Cell D2 and drag down:
=IF(NOT(ISERROR(MATCH(A2,$E$2:$E$20,FALSE))),B2,"")
In row 22, change the month names to be the full name, OR in column C, change the month names to abbreviated 3-letter names, this is so we can make use of the SumIf function.
Then, in Cell B23, put this formula and drag it across:
=SUMIF($C$2:$C$16,B22,$D$2:$D$16)
(I put the formula in row 24 to check against the data you already had in Row 23)
Shouldn't be much harder without a helper column. Just make sure you have full month name in row 22 to match column C data then use this formula in B23 copied across
=SUMPRODUCT(SUMIFS($B2:$B16,$C2:$C16,B22,$A2:$A16,$E2:$E20))

Resources