How do I sum a set of specific values per column along a range within a row if the corresponding column's cell isn't blank?

I have an array of cells. Each column has a corresponding numerical value. Within each row, a cell may contain text. I need to sum up the corresponding values for each row from the numbers pertaining to each column if the corresponding cell contains any text.

Given column values in B1:G1, in A2 and below use the formula =SUMIF(B2:G2;"*";B$1:G$1).

EDIT: Choose menu Tools - Options… - LibreOffice Calc - Calculate, and check Enable wildcards in formulas.

See LibreOffice Help on SUMIF

See sample file.

Tested with LibreOffice 6.4.7.2 (x86); OS: Windows 6.1.


Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information. Thanks.

Check the mark (Answer markCorrect answer mark) to the left of the answer that solves your question.

If the answer helped you, you can mark the up arrow (Upvote mark) that is on the left (to vote, you need to have karma of at least 5).

For some reason, "*" isn’t working on my sheet. I’m certain I’ve followed these steps, however.

This is the exact formula I have in cell BK4: =SUMIF(D4:BJ4,"*",D$2:BJ$2) The value, however, remains at 0 when it should be 10 (1+1+4+4).

Just added a second paragraph to the answer.

I’m afraid “Enable wildcards in formulas” is already enabled.

Values in B1:G1 (as in the sample file), are numbers or numbers as text?

Press Ctrl+F8: if values are blue they are numbers; if black, are text. Tell us (press Ctrl+F8 again to revert to normal colors). If they are numbers, click edit below your question and use the paper clip to upload a sample file (remove all sensible data before).

Alternatively: Select the four cells, and look at the status bar (just to the left of the zoom bar): it they are numbers must show Sum: 10.

Regards.