'SUMIFS Formula giving wrong result for calculating YTD-1 Value

I tried to sum up all the months until the current month. However, the formula is not working. .

I get a 0 for all rows.

Can somebody help me figure out where the problem is?

=SUMIFS(H4:AS4;$H$2:$AS$2;"<="&MONTH(TODAY());$H$1:$AS$1;YEAR(TODAY())-1)

enter image description here



Solution 1:[1]

In row 2, you show the months as 01, 02 etc and it looks like text as they are to the left of the cell. Numbers go to the right unless you have formatted them to be to the left.

Then your month(today()) will give a 1 or 2 or 3 as the result without a leading 0, which will then not match as testing 03 = 3 may not work especially if the 03 is entered as text.

You might need to consider the years as well.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Solar Mike