textafter and textbefore function alternate in excel-2016

AFZAL SOHAIL

Board Regular
Joined
May 31, 2023
Messages
115
Office Version
  1. 2021
  2. 2016
Platform
  1. Windows
Dear Team,
I want to know what is alternate of textafter and textbefore function in excel-2016
I see a formula in this page;
Cell Formulas
RangeFormula
K2:K3K2=TEXTBEFORE(J2,"h ")*60+TEXTAFTER(TEXTBEFORE(J2,"m"),"h ")

I want to know the alternate in excel 2016
Thanks a lot for your reply please..
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
can you give an example of the TEXT you want to use those functions on
and also the result expected
that does not have text with "h " or "M"
seems to be some sort of Time manipulation based on text that has so many hours and mins
ie

6h 5m
and then converts to minutes
But just guessing


=TEXTBEFORE(J2,"h ")*60
this bit - multiplies the hours by 60 to get minutes

TEXTAFTER(TEXTBEFORE(J2,"m"),"h ")
will extract just the minutes and add them - so the number between the h and m

so
=LEFT(A2,FIND("h",A2)-1)*60
will find the Hour part
and then maybe
=MID(A2,FIND("h ",A2)+2,(FIND("m",A2))-(FIND("h ",A2)+2))
for the mins


=(LEFT(A2,FIND("h",A2)-1)*60)+(MID(A2,FIND("h ",A2)+2,(FIND("m",A2))-(FIND("h ",A2)+2))*1)


Book4
ABCD
1
21h 5m60565
Sheet1
Cell Formulas
RangeFormula
B2B2=LEFT(A2,FIND("h",A2)-1)*60
C2C2=MID(A2,FIND("h ",A2)+2,(FIND("m",A2))-(FIND("h ",A2)+2))
D2D2=(LEFT(A2,FIND("h",A2)-1)*60)+(MID(A2,FIND("h ",A2)+2,(FIND("m",A2))-(FIND("h ",A2)+2))*1)
 
Last edited:
Upvote 0
Sir you are right guessing.
some example are there and the results:-

1h 30m
90​
21h 0m
1260​
3h 10m
190​
 
Upvote 0
did you try the formula i gave
=(LEFT(A2,FIND("h",A2)-1)*60)+(MID(A2,FIND("h ",A2)+2,(FIND("m",A2))-(FIND("h ",A2)+2))*1)

Book7
ABC
1
21h 30m9090
321h 0m12601260
43h 10m190190
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=(LEFT(A2,FIND("h",A2)-1)*60)+(MID(A2,FIND("h ",A2)+2,(FIND("m",A2))-(FIND("h ",A2)+2))*1)
 
Upvote 0
Hi, just another option if you're interested.
Book1
ABC
1
21h 30m9090
321h 0m12601260
43h 10m190190
Sheet1
Cell Formulas
RangeFormula
C2:C4C2=SUBSTITUTE(LEFT(A2,LEN(A2)-1),"h",":")*24*60
 
Upvote 0
Thanks a lot Sir FORM R,
This is also a very nice and simple option Sir..
 
Upvote 0
Sir if it is in this form than what will be formula?
2 hr. 09 min.
3 hr. 00 min.
1 hr. 53 min.
 
Upvote 0
My suggestion would look like this:

Book1
AB
1
22 hr. 09 min.129
33 hr. 00 min.180
41 hr. 53 min.113
Sheet1
Cell Formulas
RangeFormula
B2:B4B2=SUBSTITUTE(LEFT(A2,LEN(A2)-4),"hr.",":")*24*60
 
Upvote 0

Forum statistics

Threads
1,215,452
Messages
6,124,916
Members
449,195
Latest member
Stevenciu

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