Ask Your Question
1

How to SUMIF that tests if length of cell is 1

asked 2017-02-28 12:01:57 +0200

migueldealmeida gravatar image

Consider the following:

image description

What is the formula that "sums column C if the length of the corresponding cell in column A is =1" ?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2017-02-28 14:00:54 +0200

karolus gravatar image

Hallo

Solution with the Swiss-Army-Knife in terms of functions:
=SUMPRODUCT(LEN(A1:A4)=1, C1:C4)

edit flag offensive delete link more

Comments

Yes. Much better imo.

Lupp gravatar imageLupp ( 2017-02-28 14:37:28 +0200 )edit

Agree. This may be also faster.

Mike Kaganski gravatar imageMike Kaganski ( 2017-03-01 09:40:37 +0200 )edit

Aha! I agree, this was what I was looking for! Thanks :)

migueldealmeida gravatar imagemigueldealmeida ( 2017-03-01 15:36:40 +0200 )edit
0

answered 2017-02-28 12:26:12 +0200

updated 2017-02-28 12:26:40 +0200

If you use wildcards in formulas (default for recent LO versions), then you may use "=?" as criteria. If you use regular expressions, your criteria will be "=.". See Tools->Options->LibreOffice Calc->Calculate for settings that control using regexes/wildcards in formulas.

edit flag offensive delete link more

Comments

I have wildcards on. Not sure how to write it. Do you mean =SUMIF(A1:A4,LEN(=?)=1,C1:C4) ? This formula doesn't work.

migueldealmeida gravatar imagemigueldealmeida ( 2017-02-28 12:36:48 +0200 )edit

=SUMIF(A1:A4,"=?",C1:C4)

Mike Kaganski gravatar imageMike Kaganski ( 2017-02-28 12:37:39 +0200 )edit
1

Note that "=?" depends on the Tools-Options-Calc-Calculate setting "Search criteria = and <> must apply to whole cells", if that is disabled the search matches any cell content of at least one character, not just one character.

erAck gravatar imageerAck ( 2017-02-28 13:04:59 +0200 )edit

The = inside the criteria-expression is optional both (wildcard|regEx) works without it.
anyway I would prefer a solution without dependencies of weird settings…see my Answer

karolus gravatar imagekarolus ( 2017-02-28 13:53:16 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2017-02-28 12:01:57 +0200

Seen: 258 times

Last updated: Feb 28 '17