Sum text that contains numbers - But ONLY the numbers.

Sumitup8

New Member
Joined
Mar 27, 2019
Messages
4
Hi all,

I am trying to do a planning schedule, which includes different earnings, such as; sick days, holiday earned, lieue days earned/taken, compensation earned/taken. The hoiday earned, and sick days were very simple because all I did was color code "H" for Holiday, and to the very right had a column in which it counted the "H"for holidays so that we know how many remains.

I encountered the problem when I need to sum hours earned in different ways, such as Lieue Hours, and Compensation Hours.

LE+amount of hours = LE1.25, and so on. LE = Lieue Earned.
LT+amount of hours = LT1.25, and so on. LT = Lieue Taken.
CT+amount of hours = CT1.25, and so on. CT = Compensation Taken.
CE+Amount of hours = CE1.25, and so on. CE = Compensation Earned.


Name
1 May
2 May
3 May
4 May
5 May
6 May
7 May
Lieue Earned
Lieue Taken
Comp. Earned
Comp. Taken
Peter
CE2.25
CT1.25
LE4.25
LT3.25
4.25
3.25
2.25
1.25
Pan
CE1.25
CT1
LE4
LT4
4
4
1.25
1
Rose
CE1.5
CT1.5
LE5
LT4
5
4
1.5
1.5
Bert
CE1.25
CT0.5
LE5
LT5
1.25
0.5
LE5
LT5

<tbody>
</tbody>

I have scowered the net but unable to find anything that helps. I tried the sum if right / left code but didnt get it to work..

Please, if anyone has tips for me?
 

Some videos you may like

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Ron Coderre

MrExcel MVP
Joined
Jan 14, 2009
Messages
2,316
I restructured your data a bit


Code:
Using this:
  A       B        C        D        E        F        G        H        I             J            K             L
1                                                                        LE            LT           CE            CT
2 Name    1-May    2-May    3-May    4-May    5-May    6-May    7-May    Lieue_Earned  Lieue_Taken  Comp._Earned  Comp._Taken
3 Peter   CE2.25                     CT1.25            LE4.25   LT3.25   4.25          3.25         2.25          1.25
4 Pan              CE1.25  CT1                         LE4      LT4      4.00          4.00         1.25          1.00
5 Rose    CE1.5    CT1.5             LE5      LT4                        5.00          4.00         1.50          1.50
6 Bert             CE1.25  CT0.5              LE.5     LT.5              1.25          0.50         0.50          0.50



Code:
J3: =SUMPRODUCT(REPLACE($B3:$H3,1,2,"0")*(LEFT($B3:$H3,2)=J$1))
Copy J3 down through J6


Copy J3:J6 and Paste into L3:L6


Is that something you can work with?
 

Sumitup8

New Member
Joined
Mar 27, 2019
Messages
4
Hi Ron,

Thank you for your reply.

It did not work as expected, however I believe it is user error from my side.

In case anyone has a similar issue, you can try to go around it like this;
=SUMIF(B1:I1, ">0") .. --- So it will sum anything above 0 (ZERO) to a column.
=SUMIF(B1:I1, "<0") .. --- So it will sum anything below 0 (ZERO) to a column.




A
B
C
D
E
F
G
H
I
J
1
Name:

5/1-19

5/2-19
5/3-19
5/4-19
5/5-19
5/6-19
5/7-19
Comp Earned
Comp Taken

2
Slavko

0.250.5-0.50.75
-0.5
3
Milica
0.75-0.250.75-0.25

<tbody>
</tbody>

Then I have formatted the cells to turn into a specific color if the number is <0.20 and another color if it is >0.20.

This gave me the result I was looking for.

Thank you and have a nice weekend!
 

Sumitup8

New Member
Joined
Mar 27, 2019
Messages
4
I made a mistake, please refer to below table and explanation;

(should be inputed in I1) =SUMIF(B1:H1, ">0") .. --- So it will sum anything above 0 (ZERO) to a column.
(should be inputed in I1) =SUMIF(B1:H1, "<0") .. --- So it will sum anything below 0 (ZERO) to a column.

A
B
C
D
E
F
G
H
I
J
1
Name:

5/1-19

5/2-19
5/3-19
5/4-19
5/5-19
5/6-19
5/7-19
Comp Earned
Comp Taken

2
Slavko

0.25
0.5
-0.5
0.75
-0.5
3
Milica
0.75
-0.25
0.75
-0.25

<tbody>
</tbody>
 

Watch MrExcel Video

Forum statistics

Threads
1,123,281
Messages
5,600,720
Members
414,401
Latest member
grenona2020

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