Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index


If you have one row per day of the year, you can find out easily where
the row corresponding to "TODAY()-1" is located by finding out the
number of days between Jan 1st of that year and "yesterday". This would
be something like (you may need to adjust based on the heading of your


The formula above calculates the number of days between yesterday last
year and Jan 1st of last year. Now, you need to find in which column to
add. Since you seem to have a heading providing the year, you can use
the MATCH() function to locate the column:


This should give you the column where last year's data is located (I
used a1 to z1, but any row reference will work).

To add the values, you now just need to use a combination of SUM() and


What that does:

OFFSET() allows you to create dynamic arrays for functions like SUM().
I used the anchor point $A$2 (I supposed your heading is in row 1), and
told OFFSET to move from that reference 0 rows down and
"MATCH(YEAR(TODAY()-1)-1;$a$1:$z$1;0)-1" columns to the right; then,
from that new point, make an array that is "DAYS(YEAR(TODAY()-1)-
1;MONTH(TODAY()-1);DAY(TODAY()-1);YEAR(TODAY()-1)-1;1;1)" rows high and
1 column wide. The resulting array is then used by SUM() to calculate
the total rainfall.

This will probably need to be adjusted a bit to take into account the
position of your column heading and to correctly find the row where to
stop, but you should now have something to play with.

I hope this helps.

Rémy Gauthier.

Le dimanche 07 mai 2017 à 21:55 +0200, Hylton Conacher (ZR1HPC) a
écrit :

I have a spreadsheet I use to draw graphs and extract information
the rainfall in my area for the last two years.

I need to create a formula that will count how many days it rained 
between the start of the year, both last year and this year, so I
compare the amount of rainfall that was received during that time

The example below is a sample dataset that shows how much rainfall
received in 2016 or 2017, on each of the four days

Month   Day     2016    2017
Jan     1       0       15
Feb     29      1       0       
May     6       0       1
Sept    22      15      5

 From this we can determine that 16mm of rain fell in 2016 over 2
Likewise we can determine that 21mm of rain fell in 2017 but over 3

Today is the 7th of May 2017 and I would like a formula to work out
many days the rainfall received between(and incl) 2016/01/01 and the
before TODAY last year. The answer for 2016 is 1 i.e. it only rained 
once between the dates specified, however the answer for 2017 is 16
it rained twice between TODAY-1 and 2017/1/1. I had thought of using 
COUNTIF or DAYS or =COUNTIF(C2:SUM(TODAY()-1,">0")), however the
is that I do not have a single date column, but three.

This formula will allow me to create a graph showing how much
had fallen last year compared to this year between the beginning of
year(01/01) and the day prior to Today.

I had thought of converting the first two columns into a single and 
having the text name of the month with each successive line being a
date in that month until the month changed, however I was unable to
it to work i.e. automatically change month after 31 days in January
read February 01.
As you can imagine I have 367 rows of data per year, mostly with 0 as
value, however there are odd days it does rain.

Any comments, and if you want the original spreadsheet, just yell
to put it i.e. Nabble etc.


To unsubscribe e-mail to:
Posting guidelines + more:
List archive:
All messages sent to this list will be publicly archived and cannot be deleted


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.