sum cells based on content

Kutrenia

New Member
Joined
Dec 31, 2009
Messages
17
I'm working on a timesheet, trying to get it to add the various types of leave based on what kind of leave is taken. For the most part, I have this working using the following formula:

{=SUM(IF(ISNUMBER(FIND(R$1,C2:P2)),VALUE(LEFT(C2:P2,FIND(R$1,C2:P2)-1)),0))}
It is only when there is more than one type of leave in the cell that I run into issues.

Sample:
Dates are shown on Row 1 beginning in Column C
Leave taken starts on Row 2 thru 19

3/8/2015 3/9/2015 3/10/2015 3/11/2015 .... 3/21/2015 AL S CRW CRT ADM
2AL / 2CRT, 3AL / 2S ...I should get 5AL, 2S, 2CRT under the appropriate headings without the text 5,2,2
but S just show "# Value!"

R1 = AL
S1 = S
T1 = CRW
U1 = CRT
V1 = ADM

Any assistance would be greatly appreciated!
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi,

It might help members to give you appropriate feedback if you would consider posting a small sample of data with expected result. 6 columns max and 6 rows are sufficient.
 
Upvote 0
[TABLE="class: grid, width: 500, align: center"]
<TBODY>[TR]
[TD]3/3/2015
[/TD]
[TD]3/4/2015
[/TD]
[TD]3/5/2015
[/TD]
[TD]AL
[/TD]
[TD]S
[/TD]
[TD]CRT
[/TD]
[/TR]
[TR]
[TD]1.25 CRT
[/TD]
[TD][/TD]
[TD]2 CRT, 2 S
[/TD]
[TD][/TD]
[TD]#Value!
[/TD]
[TD]1.25
[/TD]
[/TR]
[TR]
[TD]8 S
[/TD]
[TD]8 S
[/TD]
[TD]8 S
[/TD]
[TD][/TD]
[TD]24
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3 AL
[/TD]
[TD]1 S
[/TD]
[TD]5 AL
[/TD]
[TD]8
[/TD]
[TD]1
[/TD]
[TD][/TD]
[/TR]
</TBODY>[/TABLE]
In this sample: The first row under the heading S (Sick Leave) should show 2, and CRT (Credits Taken) should show 3.25.
 
Last edited:
Upvote 0
Thanks.
I do not have a solution however I do have a suggestion.
Problem solving often starts with how the data is presented.
In your case I do not know if it is generated by an external program or copied from the web or hard coded.
If hard coded please do consider the alternative:

Excel 2013
ABCDEFGHIJ
1datetypeqtySum of qtyType
23/3/2015CRT1.25DatesCRTSALGrand Total
33/5/2015CRT23/3/20151.258312.25
43/5/2015S23/4/201599
53/3/2015S83/5/2015210517
63/4/2015S8Grand Total3.2527838.25
73/5/2015S8
83/3/2015AL3
93/4/2015S1
103/5/2015AL5
Kutrenia



Few Columns and multiples Rows is better than the opposite.
Data could then be easily extracted with a simple Pivot Table (her is F1).

For your perusal.
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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