Excel 2021 - Sum cells that contain text for total and total by month

BrerRabbit

Board Regular
Joined
Aug 20, 2023
Messages
66
Office Version
  1. 2021
  2. 2016
  3. 2013
Platform
  1. Windows
I'm doing a personal project for gardening. One aspect is that I am calculating the number of eggs laid by my chickens to be summed over time and by month.

I do have this formula: SUM(--RIGHT(D2:H2,LEN(D2:H2)-FIND("= ",D2:H2))). Thing is I don't understand this type of formula, so I'm not sure how to modify it to:
. calculate even if some cells don't have the "= " sign
. to sum for each month. which means look at the date in the first row and extracting the month. I understand that that formula would be =text(D2,"mmmm") for a single cell or column.
. sums will be done on a separate tab with months across the top.

With below, this formula gives a #VALUE response as D2 and E2 don't have the equals sign, even though the answer is 3.

Thank you in advance for your help.

Screenshot 2024-04-17 185336.png
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
One way: To add "eggs=0" into all cells
without month
=SUMPRODUCT(SUBSTITUTE(MID(D2:H2&"eggs=0",SEARCH("eggs=",D2:H2&"eggs=0")+5,255),"eggs=0","")+0)
with month criteria
=SUMPRODUCT((MONTH(D1:H1=4)*SUBSTITUTE(MID(D2:H2&"eggs=0",SEARCH("eggs=",D2:H2&"eggs=0")+5,255),"eggs=0","")))

Caculation assistance.xlsx
DEFGH
107 April 202408 April 202409 April 202410 April 202411 April 2024
2asdad daddad blah blah eggs=1dad blah blah dad blah blah eggs=2asdasd
33without month
43with month, with D1:H1 was actual date
Sheet2
Cell Formulas
RangeFormula
E1:H1E1=D1+1
E3E3=SUMPRODUCT(SUBSTITUTE(MID(D2:H2&"eggs=0",SEARCH("eggs=",D2:H2&"eggs=0")+5,255),"eggs=0","")+0)
E4E4=SUMPRODUCT((MONTH(D1:H1=4)*SUBSTITUTE(MID(D2:H2&"eggs=0",SEARCH("eggs=",D2:H2&"eggs=0")+5,255),"eggs=0","")))
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,685
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top