Calc add row below based on a cell value

Discuss the spreadsheet application
Post Reply
zarenco
Posts: 4
Joined: Mon Sep 17, 2018 10:26 am

Calc add row below based on a cell value

Post by zarenco »

hi all,
i need to insert a row based on a cell value(if cell value>0 add a new blank row below). Can someone help me...
thanks...
OpenOffice 4 on Windows 7
User avatar
MrProgrammer
Moderator
Posts: 4909
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: calc add row below based on a cell value

Post by MrProgrammer »

Hi, and welcome to the forum.
zarenco wrote:i need to insert a row based on a cell value(if cell value>0 add a new blank row below).
The answer depends on why you want the new row. Are you inserting the row so you can enter data there? Or are you inserting the row just to visually separate your data?
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
zarenco
Posts: 4
Joined: Mon Sep 17, 2018 10:26 am

Re: calc add row below based on a cell value

Post by zarenco »

The new row is for enter data...and it has to be the same format as above row ..
OpenOffice 4 on Windows 7
User avatar
MrProgrammer
Moderator
Posts: 4909
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: calc add row below based on a cell value

Post by MrProgrammer »

zarenco wrote:if cell value>0 add a new blank row below
Let's say your cell values are in column D. Pick an unused column. I will use Z an an example. Put 0 in Z1. In Z2 enter formula =Z1<>(D1>0). Fill Z2's formula down the column as needed to match the data in column D. Select column Z. Data → Subtotals → GroupBy=0 → Function=COUNT → ✓Subtotals=0 → OK. Data → Group and Outline → Remove. Clear column Z.
zarenco wrote:it has to be the same format as above row
Format your columns using Styles.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
elinadicosta
Posts: 7
Joined: Tue Sep 18, 2018 5:07 am

Re: calc add row below based on a cell value

Post by elinadicosta »

You can insert row by using formula.
Elina Dicosta
OpenOffice Version 3.3
Windows 10
zarenco
Posts: 4
Joined: Mon Sep 17, 2018 10:26 am

Re: calc add row below based on a cell value

Post by zarenco »

Let's say your cell values are in column D. Pick an unused column. I will use Z an an example. Put 0 in Z1. In Z2 enter formula =Z1<>(D1>0). Fill Z2's formula down the column as needed to match the data in column D. Select column Z. Data → Subtotals → GroupBy=0 → Function=COUNT → ✓Subtotals=0 → OK. Data → Group and Outline → Remove. Clear column Z.
MrProgrammer wrote:
zarenco wrote:if cell value>0 add a new blank row below
Let's say your cell values are in column D. Pick an unused column. I will use Z an an example. Put 0 in Z1. In Z2 enter formula =Z1<>(D1>0). Fill Z2's formula down the column as needed to match the data in column D. Select column Z. Data → Subtotals → GroupBy=0 → Function=COUNT → ✓Subtotals=0 → OK. Data → Group and Outline → Remove. Clear column Z.
zarenco wrote:it has to be the same format as above row
Format your columns using Styles.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Thanks for your solution, but i'm looking for an automatic process that alows me to do that row insertion(like a macro). When i enter data to a cell from a row, based on that cell's value, a new row has to be inserted below if condition is met.
OpenOffice 4 on Windows 7
zarenco
Posts: 4
Joined: Mon Sep 17, 2018 10:26 am

Re: calc add row below based on a cell value

Post by zarenco »

elinadicosta wrote:You can insert row by using formula.
What formula, if you dont't mind?
OpenOffice 4 on Windows 7
User avatar
robleyd
Moderator
Posts: 5087
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: calc add row below based on a cell value

Post by robleyd »

zarenco wrote:
elinadicosta wrote:You can insert row by using formula.
What formula, if you dont't mind?
Yes, we'd all love to know the formula to use :?:

@zarenco - the script in this topic might be useful for you.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
User avatar
Zizi64
Volunteer
Posts: 11363
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Calc add row below based on a cell value

Post by Zizi64 »

A formula will refresh at every related events: Opening the document, Saving the document, when the related cell is changed, when you hit Ctrl-Shift-F9...
Every event activates the formula: it will be insert a new row again and again... (if you can create such macro function).
This behavior is appropriate for you?
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply