Formula Help: Summing numbers from text cells, that occur before/after specific characters

Four Fried Chickens

New Member
Joined
Sep 21, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I need help creating different formula strings that can return a sum from text cells that contain multiple different numbers. Not the best way to collect data, I know, but until our org develops skills in Microsoft Access this is a direction we're trying (need to make it easy for many users, put all the data in one spot, etc.).

Here's an example:
EventJohnnySuzieBillySums: # committed to
invite (need help)
Sums: # invited
(need help)
Sums: # responded yes
(need help)
Midnight JamboreeAttending
Invited 5/5
1 yes 2 no 2 unknown
Attending
Invited 0/5
Attending
Invited 1/1
1 yes
Monster MashCan't be thereAttending
Invited 2/5
2 no
Attending
Invited 3/7
2 yes 1 no
Time WarpCan't be there
Invited 1/1
1 yes
Can't be thereAttending
Invited 3/4
3 unknown

I've been working with SUM, LEFT, MID, LEN, RIGHT, FIND, SEQUENCE, and VALUE functions. I've gotten close, but I'm at the point where I need to ask for help.

Column E (# committed): Need to extract and sum all numbers preceding "/" (or after "Invited")
Column F (# invited): Need to extract and sum all numbers directly following "/" on the second line
Column G (# yes): Need to extract all numbers that directly precede the word "yes"

All numbers will be one digit 98% of the time. There's a chance there would occasionally be two digits - but if the solution can only be achieved by harvesting a single digit, that would be ok, we can manually add a 10 in those cases.

Thanks!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
try this
--------------
Book1
ABCDEFG
1EventJohnnySuzieBillySums: # committed to invite (need help)Sums: # invited (need help)Sums: # responded yes (need help)
2Midnight JamboreeAttending Invited 5/5 1 yes 2 no 2 unknownAttending Invited 0/5Attending Invited 1/1 1 yes6112
3Monster MashCan't be thereAttending Invited 2/5 2 noAttending Invited 3/7 2 yes 1 no5122
4Time WarpCan't be there Invited 1/1 1 yesCan't be thereAttending Invited 3/4 3 unknown451
Sheet2
Cell Formulas
RangeFormula
E2:E4E2=SUM(VALUE(IFERROR(RIGHT(TEXTBEFORE(B2:D2,"/",1),1),0)))
F2:F4F2=SUM(VALUE(IFERROR(LEFT(TEXTAFTER(B2:D2,"/",1),1),0)))
G2:G4G2=SUM(VALUE(IFERROR(RIGHT(TEXTBEFORE(B2:D2," yes",1),1),0)))
 
Upvote 0
Try the following
I recommend that you do not use merged cells.
N.B. You can post an extract of your sheet with the forum's tool named Xl2BB.

TextBefore.xlsm
ABCDEFG
1
2
3EventJohnnySuzieBillySums: # committed toSums: # invitedSums: # responded yes
4invite (need help)(need help)(need help)
5Midnight JamboreeAttendingAttendingAttending6112
6Invited 5/5Invited 0/5Invited 1/1
71 yes 2 no 2 unknown1 yes
3c
Cell Formulas
RangeFormula
E5E5=TEXTAFTER(TEXTBEFORE(B6,"/"),"Invited ")+TEXTAFTER(TEXTBEFORE(C6,"/"),"Invited ")+TEXTAFTER(TEXTBEFORE(D6,"/"),"Invited ")
F5F5=TEXTAFTER(B6,"/")+TEXTAFTER(C6,"/")+TEXTAFTER(D6,"/")
G5G5=TEXTBEFORE(B7," yes")+IFERROR(TEXTBEFORE(C7," yes"),0)+TEXTBEFORE(D7," yes")
 
Upvote 0
here's another version with the merged cells
-----------------
Book1
ABCDEFG
13Midnight JamboreeAttendingAttendingAttending6112
14Invited 5/5Invited 0/5Invited 1/1
151 yes 2 no 2 unknown1 yes
16Monster MashCan't be thereAttendingAttending5122
17Invited 2/5Invited 3/7
182 no2 yes 1 no
19Time WarpCan't be thereCan't be thereAttending451
20Invited 1/1Invited 3/4
211 yes3 unknown
sum numbers from text
Cell Formulas
RangeFormula
E13,E16,E19E13=SUM(VALUE(IFERROR(LEFT(TEXTAFTER(B14:D14," ",1),1),0)))
F13,F16,F19F13=SUM(VALUE(IFERROR(LEFT(TEXTAFTER(B14:D14,"/",1),1),0)))
G13,G16,G19G13=SUM(VALUE(IFERROR(RIGHT(TEXTBEFORE(B15:D15," yes",1),1),0)))
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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