Find first and last row that includes specific text

Ahlis1979

New Member
Joined
May 22, 2017
Messages
15
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
In the column named Example it should show the time different between every status change and when the when status is CLOSE I want to do a time different between status NEW and status CLOSE.
excel.PNG


Hope you guys have some great answer to this question. :)

Best Regards
Ahlis
 

Attachments

  • excel.PNG
    excel.PNG
    21.7 KB · Views: 20

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
What version of Excel are you using?
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)


Also can you please post some sample data.
MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0
Hi,

Thanks for the info. I have updated my profile now.

I'm using Excel 2016

Will check XL2BB Add-In.

Best Regards
Ahlis
 
Upvote 0
Here is from the sheet where the data should be added: The code for both leadtime (Ledtid) and time between NEW and CLOSE should be in column J.
Column C & I is the column that has the data for criteria and column G is where it should do time is in.
Cell Formulas
RangeFormula
E2:E17E2=VALUE(A2)
F2:F17F2=IFERROR(IF(MATCH(I2,Arbetsordrar!$B$2:$B$7275,0)>0,"Träff","Miss"),"MISS")
G2:G17G2=TEXT($B2-1462,"ÅÅÅÅ-MM-DD tt:mm")
H2:H17H2=IFERROR(INDEX(Arbetsordrar!$Z$2:$Z$7275,MATCH(Wostatus!I2,Arbetsordrar!$B$2:$B$7275,0),1),"Data saknas!")
I2:I17I2=IFERROR(IF(A2="","",VALUE(A2)),"")
J2:J7J2=IF(C2="CLOSE",F&INDEX(ROW(),MATCH("CLOSE",C8,0),1)-G2,IF(I3=I2,G3-G2,""))
J8:J17J8=IF(C8="CLOSE",INDIRECT(ADDRESS(ROW(),7),TRUE)-INDIRECT(ADDRESS(MIN(IF(ISNUMBER(SEARCH("NEW",C2:C13)),ROW(C2:C13))),7)),IF(I9=I8,G9-G8,""))


Nice Add-In. :)

Best Regards
Ahlis
 
Upvote 0
Thanks for that, how about
+Fluff 1.xlsm
CDEFGHIJ
1StatusÄndrat avAO NumkontrollKorrekt statusdatumStatusKorrekt AOLedtid
2NEWMAXADMIN175818Träff01/01/2020 01:02FU1758180:00:00
3WSCHMAXADMIN175818Träff01/01/2020 01:02FU175818224:31:00
4WAIT FOR SCHEDKN5711175818Träff10/01/2020 09:33FU175818244:02:00
5SCHEDULEDKN5711175818Träff20/01/2020 13:35FU17581896:39:00
6ASSIGNEDKN5711175818Träff24/01/2020 14:14FU17581869:28:00
7INPRGDS5073175818Träff27/01/2020 11:42FU17581819:05:00
8CLOSEDS5073175818Träff28/01/2020 06:47FU175818653:45:00
9NEWMAXADMIN175829Träff02/01/2020 01:01AUUP1758290:00:00
10WSCHMAXADMIN175829Träff02/01/2020 01:01AUUP175829125:11:00
11PLANNEDDS69207175829Träff07/01/2020 06:12AUUP175829175:06:00
12WAIT FOR SCHEDDS69207175829Träff14/01/2020 13:18AUUP17582964:45:00
13ASSIGNEDDS69207175829Träff17/01/2020 06:03AUUP175829175:26:00
14COMPFW5674175829Träff24/01/2020 13:29AUUP175829145:46:00
15CLOSEFW5674175829Träff30/01/2020 15:15AUUP175829686:14:00
16NEWMAXADMIN175844Träff02/01/2020 01:02AUUP1758440:00:00
List
Cell Formulas
RangeFormula
J2:J16J2=IF(C2="New",0,IF(C2="Close",G2-LOOKUP("new",C$2:C2,G$2:G2),G3-G2))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,112
Members
452,302
Latest member
TaMere

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