How to SUMIF that tests if length of cell is 1 [closed]

Consider the following:

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

edit retag reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp close date 2020-09-26 11:30:03.437325

Sort by » oldest newest most voted

Hallo

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

more

Yes. Much better imo.

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

Agree. This may be also faster.

( 2017-03-01 09:40:37 +0200 )edit

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

( 2017-03-01 15:36:40 +0200 )edit

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.

more

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.

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

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

( 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.

( 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

( 2017-02-28 13:53:16 +0200 )edit

Stats

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

Seen: 703 times

Last updated: Feb 28 '17