[Solved] Sort incremented dates

Discuss the spreadsheet application
Locked
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

[Solved] Sort incremented dates

Post by cephas »

The first set of rows in the spreadsheet retrieve the date from another sheet. For example

Code: Select all

=FixedAmts.F39
, and then the next iteration of that row will be

Code: Select all

=SUM(B12+30)
. That is repeated down the date column for all types.

However, when I sort by date, the dates that were positional keep getting messed up. Should I be using the 'dollar' sign. All the dates are of type 'date'. It's just that after the sort, B12 is now another row, but the values are not getting adjusted correctly.
Last edited by cephas on Fri May 09, 2025 11:17 am, edited 1 time in total.
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
User avatar
robleyd
Moderator
Posts: 5383
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Sorting incremented dates

Post by robleyd »

We could guess as to how your spreadsheet is designed, or you could upload a sample file that demonstrates the issue.
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 25.2.4.3; SlackBuild for 25.2.4 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue]
Unexpected '{' on line 32
.
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: Sorting incremented dates

Post by cephas »

Yes, good idea. I need to do some more testing first, using the "$".
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
User avatar
robleyd
Moderator
Posts: 5383
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Sorting incremented dates

Post by robleyd »

Code: Select all

=SUM(B12+30)
You don't need the SUM here. =B12+30 returns a single value; SUM is intended to return the sum (surprise) of a number of values.

For better understanding of use of the $ you may wish to read [Tutorial] Absolute, relative and mixed references
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 25.2.4.3; SlackBuild for 25.2.4 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue]
Unexpected '{' on line 32
.
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: Sorting incremented dates

Post by cephas »

Okay, I will remove the SUM's
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: Sorting incremented dates

Post by cephas »

Here is some test data
test_sortdates.ods
(31.57 KiB) Downloaded 11 times
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
User avatar
MrProgrammer
Moderator
Posts: 5265
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Sorting incremented dates

Post by MrProgrammer »

cephas wrote: Fri May 02, 2025 6:15 am However, when I sort by date, the dates that were positional keep getting messed up.
Done as attached, the dates are in order and there is no need to sort.
202505082136.ods
(20.81 KiB) Downloaded 4 times

cephas wrote: Fri May 02, 2025 9:05 am Okay, I will remove the SUM's
You didn't. I did.

If this solved your problem please go to your first post use the Edit ✏️ button and add [Solved] to the start of the Subject field. Select the green checkmark icon at the same time.

[Tutorial] VLOOKUP questions and answers
[Tutorial] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: Sorting incremented dates

Post by cephas »

MrProgrammer wrote: Fri May 09, 2025 5:09 am Done as attached the dates are in order and there is no need to sort.202505082136.ods
Great, thanks, very impressed. I have done some minor testing, changing dates and values, adding new rows by copy/paste. It all seems to work just fine. I'll do some more testing in the next few days.
MrProgrammer wrote: Fri May 09, 2025 5:09 am
cephas wrote: Fri May 02, 2025 9:05 am Okay, I will remove the SUM's
You didn't. I did.
The only SUM's left were in the balance column. I had removed all the others, however it does seem that they are not even needed in the 'Balance' column.

If I want to add new entries (not from a copy/paste), your code doesn't seem to be referencing the sheet "FixedAmts" ?? I can only assume the VLOOKUP is searching through both sheets. I will need to read up on VLOOKUP obviously and understand it.

Thanks muchly fr your help. :D
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: Sorting incremented dates

Post by cephas »

I have done more testing, adding new entries in the 'FixedAmts' sheet and then adding an entry in the first sheet, changing the 'Repeat' value,etc, etc. I must say I'm VERY impressed with the work done in creating those formulas, thank you. :D
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
Alex1
Volunteer
Posts: 828
Joined: Fri Feb 26, 2010 1:00 pm
Location: Netherlands

Re: Sorting incremented dates

Post by Alex1 »

References to FixedAmts use a name Fixed defined as $FixedAmts.$A$1:$D$30. Press Ctrl+F3 to manage defined names.
Cells containing dates and currencies are formatted using format styles. Press F11 to manage them.
AOO 4.1.15 & LO 24.8.4 on Windows 10
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: Sorting incremented dates

Post by cephas »

Alex1 wrote: Fri May 09, 2025 11:42 am References to FixedAmts use a name Fixed defined as $FixedAmts.$A$1:$D$30. Press Ctrl+F3 to manage defined names.
Ctrl+F3 definitely appears to be how a defined name setup is accessed, yet those function keys didn't work for me.

I found https://help.libreoffice.org/latest/he/ ... 70100.html , and From the menu bar: Choose Sheet - Named Ranges and Expressions - Define. --> works fine.
Alex1 wrote: Fri May 09, 2025 11:42 am Cells containing dates and currencies are formatted using format styles. Press F11 to manage them.
F11 works okay.
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: [Solved] Sorting incremented dates

Post by cephas »

The column "Repeat" is used now and reflects the number of days. How can that be tweaked for calendar months ? For example, monthly items were defined previously as

Code: Select all

=EDATE(D15,1)
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
User avatar
MrProgrammer
Moderator
Posts: 5265
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: [Solved] Sorting incremented dates

Post by MrProgrammer »

cephas wrote: Sat May 10, 2025 2:34 am How can Repeat be tweaked for calendar months [using EDATE(date;1)]?
Please review our forum policy: One issue, one thread.

This topic is about Sorting incremented dates. That issue was solved. You now have a new question about using EDATE in the formula and should have opened a new topic for it. This time I'll overlook the mistake, but don't expect to continue to receive replies from me for additional new questions in this [Solved] topic. I don't see anythig about EDATE in the first set of posts.
202505092123.ods
Formulas changed to use EDATE
(20.82 KiB) Downloaded 2 times
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
cephas
Posts: 37
Joined: Sat Aug 30, 2014 3:40 am
Location: Queensland, Australia

Re: [Solved] Sorting incremented dates

Post by cephas »

MrProgrammer wrote: Sat May 10, 2025 4:20 pm You now have a new question about using EDATE in the formula and should have opened a new topic for it.
Okay thanks, point taken. I've added a new topic and marked it as 'Solved" - viewtopic.php?t=112764
LibreOffice Version: 24.2.7.2 on Kubuntu 24.04.2
Locked