OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Sumif() - finding text is criteria for sum

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
Grandis
OOo Advocate
OOo Advocate


Joined: 05 Mar 2007
Posts: 232
Location: Norway

PostPosted: Wed May 12, 2010 7:11 am    Post subject: Sumif() - finding text is criteria for sum Reply with quote

Hi.

I want to sum numbers from range C3:C24, but only sum the cells where the cell in same row in range F3:F24 contains the text "1600". The range F3:F24 is formatted as text, not numbers.

I can insert another auxiliary coloumn that is given either 0 or 1, dependent if adjaccent cell in the C coloumn contains "1600" or not, and then used this coloumn as reference when I use the SUMIF command.

The aux coloumn would have this formula (not properly tested yet):
Code:
=IF(ISERROR(SEARCH("1600";D3;1));0;1)


I tried to include the formula above in the sumif command, but I found that it's not the right approach as sumif command deals with ranges, not single cells.

I want to know if I can do this without adding an extra coloumn.


Thanks
_________________
Windows XP sp2
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3367
Location: Manchester UK

PostPosted: Wed May 12, 2010 12:17 pm    Post subject: Reply with quote

Sorry, I don't get what's wrong with:

Code:
=SUMIF(F3:F24;"1600";C3:C24)

_________________
LibreOffice 3.6.6 on Fedora 18, LibreOffice 4.0.2 on Ubuntu 13.04 (Double Boot)
Back to top
View user's profile Send private message
Grandis
OOo Advocate
OOo Advocate


Joined: 05 Mar 2007
Posts: 232
Location: Norway

PostPosted: Wed May 12, 2010 12:33 pm    Post subject: Reply with quote

Robert Tucker wrote:
Sorry, I don't get what's wrong with:

Code:
=SUMIF(F3:F24;"1600";C3:C24)


The string "1600" is a part of more surrounding text. So no, it's not that simple. A cell could contains something like "AB1600CD".
_________________
Windows XP sp2
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3367
Location: Manchester UK

PostPosted: Wed May 12, 2010 12:41 pm    Post subject: Reply with quote

So:
Code:
=SUMIF(F3:F24;".*1600.*";C3:C24)

with "Enable regular expressions in formulas" checked at Tools>Options>OpenOffice.org Calc>Calculate ?
_________________
LibreOffice 3.6.6 on Fedora 18, LibreOffice 4.0.2 on Ubuntu 13.04 (Double Boot)
Back to top
View user's profile Send private message
Robert Tucker
Moderator
Moderator


Joined: 16 Aug 2004
Posts: 3367
Location: Manchester UK

PostPosted: Wed May 12, 2010 12:44 pm    Post subject: Reply with quote

Or:
Code:
=SUMIF(F3:F24;"1600";C3:C24)

with "Search criteria = and<> must apply to whole cells" unchecked at Tools>Options>OpenOffice.org Calc>Calculate ?
_________________
LibreOffice 3.6.6 on Fedora 18, LibreOffice 4.0.2 on Ubuntu 13.04 (Double Boot)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group