help again

Joined
Feb 10, 2004
Messages
5
I posted a msg earlier about counting hours on a payroll spread sheet. I was given this formula:
{=SUM(IF(ISERROR(MID(B3:H3,FIND("S",B3:H3)+1,255)),"",MID(B3:H3,FIND("S",B3:H3)+1,255)+0))}

which works great if I only have one code that uses "S." Unfortunately, I have several payroll codes that have "S" in them. Does anyone have a solution to my new problem?

Example,

jan 1 jan 2 jan 3 jan 4 jan 5
employee 1 S8 CSS8 W8 SA8 S8

If I want to count Sick hours, which is "S8" using the above formula, it wont work because of the Special Assignment code (SA) and the CSS code. Any suggestions would be appreciated.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
=SUM(IF(ISERROR(MID(SUBSTITUTE(SUBSTITUTE(B3:H3,"CSS","X"),"SA","X"),FIND("S",SUBSTITUTE(SUBSTITUTE(B3:H3,"CSS","X"),"SA","X"))+1,255)),"",MID(SUBSTITUTE(SUBSTITUTE(B3:H3,"CSS","X"),"SA","X"),FIND("S",SUBSTITUTE(SUBSTITUTE(B3:H3,"CSS","X"),"SA","X"))+1,255)+0))

:biggrin:
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,096
Messages
5,768,058
Members
425,451
Latest member
JohnBrooksBiddle

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
Top