I’m trying to port my Google Docs spreadsheets to onlyOffice and I am struggling a bit with some functions that need rewriting.
I hope you guys & girls can help me with this.
As an example, I have a sheet with two columns, where column A contains dates like 2023-05-04, 2024-06-07, and so forth, and column B contains amounts. I want to sum up the amounts from column B, when column A contains a specific year.
In Google Docs, we got the QUERY function, which takes a range of data and holds a query against it.
Like so: QUERY(A1:B10;“select Sum(B) where A contains ‘2025’ label sum(B) ‘’”)
In onlyOffice we got the SUMIF function.
I would rewrite the QUERY function like this:
SUMIF(A1:A10;“*2025”;B1:B10)
But that doesn’t work (it produces 0) and I figure it’s because of the fact that column A is a date, which is formatted in 2025-01-01 but really contains a very different value, something like 45658.
I have tried things like SUMIF(A1:A10;“>DATE(2025,1,1)”;B1:B10) or
SUMIF(A1:A10;“>”&DATE(2025,1,1)";B1:B10)
Hi @DeejaySane,
Please note that current Document Server version is 9.0 and version 7.2.2 was released almost 3 years ago. Please update your Document Server and check if the issue is reproduced. If it is, provide a sample file the issue can be reproduced with.
Thanks for the link.
After testing my data there, I think I found the following:
When I enter a date in a cell and the sheet automatically formats it as “Date”, it converts the date to a number (1/7/2025 for example will be represented by the number 45664), in which case the SUMIF will find nothing (0).
But when the cell doesn’t get formatted as “Date”, like when I manually set the cell to “Text”, SUMIF will work
The strangest part however is that when I manually set the cell to “Date” afterwards, the date is not converted to a number and SUMIF will work as expected
Things like SUMIF(A1:A10;“>DATE(2025,1,1)”;B1:B10) or
SUMIF(A1:A10;“>”&DATE(2025,1,1)";B1:B10) or something like SUMIF(A1:A10;YEAR(2025);B1:B10) don’t work.
If your column A contains data in Date format and column B contains data in Number format, then you can easily use formula:
=SUMIF(A1:A4,">1/1/2025",B1:B4)
Here is demo with simple values for the reference:
There is actually no need to convert dates into numbers and using DATE or YEAR, as they mess up with final calculation. Simply relying on exact dates will do the trick.
Hi @Constantine, super, thanks for your reply!
Much appreciated.
I will try this out.
The converting to a number happens automagically for some reason…
Do you by any chance know if something like “between” is possible?
So something like
I am glad to know. Basically, SUMIFS works with multiple conditions, its the only way to achieve scenario like “between this and that”, because SUMIF works with only one condition.
Frankly, SUMIFS is a very flexible formula.
I suppose the topic can be closed. If you do not feel like it, please PM, I will re-open it.