Sum of numbers in a cell that contains text and number dependant on Text Value?

Boykickscar

New Member
Joined
Mar 13, 2017
Messages
7
Hi all,

bit of a complex one, if you can help that would be fantastic...

so I am creating a calendar for employees that tracks holiday & absence (there will be other variables but for simplicity we'll keep it at that)

I need to firstly have excel identify the type of absence (illness or holiday) depending on the text identifier (H or A) then sum the value (which denotes number of hours that the absence lasts for)

here is a rough idea of how it would look... I would just need the holiday and absence columns to auto calculate.

example:
Day 1Day 2Day 3Day 4Day 5Day 6Day 7Day 8Day 9Day 10HolidayAbsence
Employee 1H880
Employee 2A4H884
Employee 3A707
Employee 4H440

<tbody>
</tbody>


I'm using excel 2013.
please let me know if you need more info or if I have not explained it well enough.

many thanks in advance
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
ABCDEFGHIJKLM
1Day1Day2Day3Day4Day5Day6Day7Day8Day9Day10HolidayAbsence
2emp1H880
3emp2A4H884
4emp3A707
5emp4H440
6

<tbody>
</tbody>

In L2 and copy down
Code:
=SUM(IF(LEFT(B2:K2,1)="H",RIGHT(B2:K2,1),0)*1)

In M2 and copy down
Code:
=SUM(IF(LEFT(B2:K2,1)="A",RIGHT(B2:K2,1),0)*1)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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