Hey peeps, appreciate any help given in advance!
I have a what looks like a simple problem but have been searching around and cracking my head on resolving it.
I will like to calculate some data results where the formula will calculate the amount of cells from the column that is more than 0 after being applied some filters.
Example using the table data:
Lets say when I apply filter to show only SG Time = PM, what formula can I use to calculate the number of visible cells for "Trade Outcome" that are more than 0? I don't want the sum of the "Trade Outcome" results, just the number of visible cells that fits criteria of "Trade outcome" more than 0.
Thanks for any help again!
[Solved] Count visible rows with criteria
[Solved] Count visible rows with criteria
Last edited by toshie on Fri Oct 18, 2024 6:51 pm, edited 1 time in total.
OpenOffice v4.1.14, Win10
- MrProgrammer
- Moderator
- Posts: 5097
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Count visible rows with criteria
Hi, and welcome to the forum.
I don't know any way for a formula to know whether an empty filtered cell is visible.
[Tutorial] The SUMPRODUCT function
If you need any additional assistance attach a spreadsheet demonstrating the situation (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the spreadsheet itself). I will not help further unless you attach a spreadsheet document.
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] Ten concepts that every Calc user should know
The only function I know of which can detect if a row has been filtered is SUBTOTAL with first operand 3. You can use that with SUMPRODUCT to get your count. I think you'll need to use an auxillary column to hold the SUBTOTAL formulas.
I don't know any way for a formula to know whether an empty filtered cell is visible.
Edit: Use an auxillary column with formula =ROW() and have SUBTOTAL check that to determine which rows are filtered. |
[Tutorial] The SUMPRODUCT function
If you need any additional assistance attach a spreadsheet demonstrating the situation (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the spreadsheet itself). I will not help further unless you attach a spreadsheet document.
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] Ten concepts that every Calc user should know
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.7, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Count visible rows with criteria
Hi MrProgrammer,
Thanks for coming forward with help and sure, I have attached a simple stripped down spreadsheet for troubleshooting. Most of the formulas I wanted are in. Left the last part which is the "Filtered Wins".
Basically, "Filtered Wins" should be able to calculate how many visible rows left with positive "Trade outcome" after being applied filter for "SG Time".
Criteria is (Trade outcome > 0).
The closest I can get is total number of visible rows which is shown in the "After Filtered Sample Size" field using subtotal.
Cheers!
Thanks for coming forward with help and sure, I have attached a simple stripped down spreadsheet for troubleshooting. Most of the formulas I wanted are in. Left the last part which is the "Filtered Wins".
Basically, "Filtered Wins" should be able to calculate how many visible rows left with positive "Trade outcome" after being applied filter for "SG Time".
Criteria is (Trade outcome > 0).
The closest I can get is total number of visible rows which is shown in the "After Filtered Sample Size" field using subtotal.
Cheers!
OpenOffice v4.1.14, Win10
- MrProgrammer
- Moderator
- Posts: 5097
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Count visible rows with criteria
Thank you for the attachment.
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.
I added formulas in columns I and J. You can use Format → Columns → Hide on them if you don't want to see them. Column J tells the formulas in F10 and F11 if the filtered row is visible. I provided a link to the SUMPRODUCT tutorial in my earlier post.
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.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.7, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Count visible rows with criteria
Thank you so much. Yes the issues is resolved.MrProgrammer wrote: ↑Fri Oct 18, 2024 4:12 pm Thank you for the attachment.
I added formulas in columns I and J. You can use Format → Columns → Hide on them if you don't want to see them. Column J tells the formulas in F10 and F11 if the filtered row is visible. I provided a link to the SUMPRODUCT tutorial in my earlier post.202410180921.ods
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.
I will further study what SUMPRODUCT can do!
OpenOffice v4.1.14, Win10