I have 5 columns of data with around 50,000 rows. This is the ambulance response times to an incident. I am trying to figure out the total number of incidents as multiple ambulances respond to a single incident. The 'IF' function has been useful upto a certain extent where the multiple ambulances reached at the same time but when it is not at the same time, it considers it as a different incident. I would like to add a buffer of 20 minutes but I am not able to figure out how to incorporate that. The second problem is with the incident number. The incidents 2014-014374-006, 2014-014374-009 are the same, just the ending numbers are different. How do I differentiate? Can I do it in excel or other platforms?
http://imgur.com/a/30VHl
To return the incident number, use a formula like this: "=IF(ISERROR(SEARCH("-",D5,SEARCH("-",D5)+1)),D5,LEFT(D5,SEARCH("-",D5,SEARCH("-",D5)+1)-1))" where D5 is the cell with your incident number.
What this formula does is it first creates an if statement that will allow you to determine if the incident has the second dash or if it doesnt. If it doesn't, then it will return the value in the cell. If it does, it will return the text to the left of that dash. The search function looks for a substring, and by nesting a search and adding "1" to the value of the first search, we are looking for the substring that comes after the first one is found.
It is a rather confusing formula the first time you use it, but it works like a charm once you understand it.
I will see if I can figure the dates out. That might be more difficult. If you can simply use the incident number for this, you will likely have an easier time.
Related
I am not familiar with excel as you can probaly guess by my question so I am sorry if it's a silly question but I have been googling for a long time and I can't do it.
I manage to do it in excel 365 with the function filter, but I can't on excel 2019 (I am required to do it in excel 2019)
I want to identifed the smaller number of a specific combination of cells using two table.
Table1 has name of people and places as well as a number. (the number shows the difference of the last time a person went to a place and the [in months])
(In this project the inspector cannot go to the same place twice unless 4 months have pass, thus why I want the smaller number, using the date of the last visited and the fcuntion now I get teh number of months that have pass)
Table2 has only the name of one person out of these people but has the name of all places. I want to get the smaller number for every place.
This is my table1: (I hided other peoples names so I can show a more compact examlplo)
And this is my table2:
I thought that I could use a function aggregate with a function if inside of it to get only the values that I desire.
It did not worked thou. Was I had miss undertand the fact that function if only gives me true or false. But thought that the aggregate function could wordk. It did not as well
=AGGREGATE(5;3;A2&B2=Table1[#Place]&Table1[#name];1).
overall my question could be summarize to which funtion should I used?
Which function should I use?
obs: In excel 365 I used concat to make a code an thus only used one cell, but I don't see why it wouldn't work if I just select two cells insted of one (teh concat cell)
is there anything i can do to further improve performance of this formula ?
=IF($A3<>"",IF(Jan!$E6<>"",LET(d_patt,IF(Jan!$E6<>"",VLOOKUP(Jan!$E6,SETTINGS!$A$12:$B$27,2,FALSE)&IF(Jan!$B6<>"",Jan!$B6,0)&IF(Jan!$C6<>"",Jan!$C6,0)&IF(Jan!$D6<>"",Jan!$D6,0),""),"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&IF(LEFT(d_patt,3)="OVT",d_patt,"OVT000")&IF(LEFT(d_patt,3)="SSI",d_patt,"SSI000")&IF(LEFT(d_patt,3)="SSO",d_patt,"SSO000")&IF(LEFT(d_patt,3)="SDS",d_patt,"SDS000")&IF(LEFT(d_patt,3)="HOL",d_patt,"HOL000")&IF(LEFT(d_patt,3)="LID",d_patt,"LID000")&IF(LEFT(d_patt,3)="UNP",d_patt,"UNP000")&IF(LEFT(d_patt,3)="FLD",d_patt,"FLD000")&IF(LEFT(d_patt,3)="MAT",d_patt,"MAT000")&IF(LEFT(d_patt,3)="LIS",d_patt,"LIS000")&IF(LEFT(d_patt,3)="CBR",d_patt,"CBR000")&IF(LEFT(d_patt,3)="ABS",d_patt,"ABS000")),"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&"OVT000SSI000SSO000SDS000HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000"),"")
i have this on a sheet for each day of the year x 400 people so 146k+ times. this is therefor taken up 80% of the sheet load time.
The sheet basically gets shift patters from Teams, check if there is any holidays, overtime etc from the relevant month tab and relevant cell for the day, and then will generate a code like below.
ROT080OVT000SSI000SSO000SDS234HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000
i have so far managed to make this faster by using the LET function, but not show if its possible to make any further improvements.
if you need an example file i can send this or upload somewhere, not sure if that is possible via stackoverflow or a preferred site to upload to.
Thanks
The following is a shortened version of your formula to reduce the complexity of computations.
Instead of building the 'OVT000SSI000...' string one piece after another while always checking if the first 3 characters of 'd_patt' match the current piece, we can set the whole string with '000's as default and only replace the section that matches 'd_patt' (see highlighted elements in screenshot below)
Which results in the full formula:
=IF(LEN($A3)>0,"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&LET(default,"OVT000SSI000SSO000SDS000HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000",d_patt,VLOOKUP(Jan!$E6,SETTINGS!$A$12:$B$27,2,FALSE)&IF(LEN(Jan!$B6)>0,Jan!$B6,0)&IF(LEN(Jan!$C6)>0,Jan!$C6,0)&IF(LEN(Jan!$D6)>0,Jan!$D6,0),IF(LEN(d_patt)>0,REPLACE(default,SEARCH(LEFT(d_patt,3),default),6,d_patt),default)),“”)
If $B6, $C6 and $D6 can only be either empty or a numerical number, in other words, if they are never a letter or special character, the 'd_patt' function can be further shortened as follows:
Which results in the full formula:
=IF(LEN($A3)>0,"ROT"&IF(LEN(Teams!$BHR4)>0,MID(Teams!$BHR4,MOD(NETWORKDAYS.INTL(Teams!$C4,I$2,"0000000")-1,LEN(Teams!$BHR4)/3)*3+1,3),"000")&LET(default,"OVT000SSI000SSO000SDS000HOL000LID000UNP000FLD000MAT000LIS000CBR000ABS000",d_patt,VLOOKUP(Jan!$E6,SETTINGS!$A$12:$B$27,2,FALSE)&(Jan!$B6+0)&(Jan!$C6+0)&(Jan!$D6+0),IF(LEN(d_patt)>0,REPLACE(default,SEARCH(LEFT(d_patt,3),default),6,d_patt),default)),“”)
I am trying to fill the sell price column in an Excel spreadsheet with the increased values in colors based on the round up columns value (1 to 50 green, 50 to 100 blue, 100 to 150 yellow, 150+ pink).
I've opted for the percentage table because some items can be sold for a lot more than what I have purchased them for, so that's just for my benefit. I am open to any other suggestions and I am new to this whole business thing.
I was using IF in my formula which would work great for using one percentage increase in the formula:
=IF($E27<50,ROUNDUP(I$27,-1))
If I try to enter a second argument like
=IF(OR($E28<50,ROUNDUP(I$28,-1)OR($E28>50,<100,ROUNDUP(J$28,-1))))
I will get an error.
I'm probably using the formulas wrong, I've tried "AND" and a couple other formulas, but I can't find anyone else trying to achieve the same or similar.
So something like this:
=IF($E28<50,ROUNDUP(I$28,-1),IF($E28>50,ROUNDUP(J$28,-1),"Error"))
But not sure what the <100 was for.
Although the problem is not completely clear, I understand that you want to add a formula with nested if statements.
I will recommend you to try nested ifs in parts.
=IF($E27<50,ROUNDUP(I$27,-1),"First if condition is false")
If everything is working as per the requirement then edit that text in the formula to add another if statement.
=IF($E27<50,ROUNDUP(I$27,-1),IF(OR(condition 1, condition 2,more conditions),"value if true","value if false"))
In the second argument provided by you, the arguments of the OR function has not been properly provided. Ensure that all the arguments of an OR function are conditions separated by a comma.
$E28<50 This is a condition so it's ok.
But other arguments are not making sense.
Also, using OR multiple times inside the first OR arguments is not clear.
It would be beneficial if you could provide the basic table and mention the requirement clearly.
I'm trying to put together a company excel sheet to keep track of the tickets we give out to senior sales to take out clients.
I put together a "Soonest Available Ticket" section to easily ID what games are coming up we still have tickets for. However, we don't give out tickets to every game and so I want to have these formulas return dates only of games that have not happened yet. Right now, they simply return the first unclaimed game which are all in the past.
I've tinkered with a few formulas, but I can't figure out how to only command it to look at dates today or later. Any ideas?
Below, in order, are my original Index formula, and then my attempts to only find upcoming games.
=IFERROR(INDEX(CubsDate,MATCH("Avail*",CubsTicketStatus,0),1),"Filled")
=IF(WhiteSoxDate>NOW(),IFERROR(INDEX(WhiteSoxDate,MATCH("Avail*",WhiteSoxTicketStatus,0),1),"Filled"),"Season Ended")
=IF(WhiteSoxDate>NOW(),INDEX(WhiteSoxDate,MATCH("Avail*",WhiteSoxTicketStatus,0),1),"Season Ended")
{=INDEX(WhiteSoxDate,(MATCH("Av*"&"*">TODAY(),WhiteSoxTicketStatus&WhiteSoxDate,0)))}
Assuming that "CubsDate" and "CubsTicketStatus" are named ranges of cells (the former containing dates and the latter the status, either "Avail" or "Filled"), then perhaps this will do what you want:
{=INDEX(CubsDate,MATCH(1,(CubsTicketStatus="Avail")*(CubsDate>TODAY()),0))}
Note that if there is no matching date after the current date, you'll get an #N/A result (which you could easily test for).
Here's a test I ran:
Note that the data here is in rows 25 - 31. Also, you'll need to format the result as a date.
Hope this helps!
Edit: Here's an explanation of how the Match function is being used. (I edited the answer so that future generations will find it more easily than if I added a comment.)
As a reminder (because I'm old and forgetful), the Match function takes three parms: Lookup Value, Lookup Array, and Match Type. So in
MATCH(1,(CubsTicketStatus="Avail")*(CubsDate>TODAY()),0)
we're looking for a value of 1 with a match type of 0 (exact match). That's the easy part. Our Lookup Array, however, is a little more complex. It consists of two tests multiplied by each other. So in each row, it looks at the value in CubsTicketStatus to see if it is "Avail" and it looks at the value in CubsDate to see if it's after today.
Each of those tests results in either TRUE or FALSE but, when you put them in the context of a mathematical calculation, they are 1 and 0. So if they're both TRUE, then you get 1 * 1, but if either (or both) is FALSE, you get zero. The Match function then returns the first row where both are TRUE -- that is, the first row where tickets are "Avail" and the date is after TODAY().
NOTE: I don't need a solution for the actual problem to be solved with Excel. I want to understand and discuss the behaviour. And I want to see, if other people can reproduce the situation and make them aware of it.
Situation is extremely simplified for debugging the problem.
I use Excel 2007 in an cooperate environment
In a calculation made on a two-week basis, I have to fill in numbers for the two-week interval that are valid a whole month. For example first two weeks of December I have to use value 12, second two weeks again, than first to weeks of January I have to use 1, second two weeks again.
Therefore I have a column for each two-week period with a field of current month (green area in screenshot). The values valid for the month are in a second table (red area). To retrieve the value for current period, I use a LOOKUP()call:
(A2): =LOOKUP(A1;$A$9:$H$9;$A$10:$H$10)
...
(P2): =LOOKUP(P1;$A$9:$H$9;$A$10:$H$10)
As you can see in the screenshot, the function goes havoc and retrieves false values.
For testing, I reproduced the situation with the international phonetic alphabet instead of month names. Therefore:
(A5): =LOOKUP(A4;$A$12:$H$12;$A$13:$H$13)
...
This time, the function works well. Therefore I guess, it has something to do with the name of months. Maybe they have some internal representation, despite the fact, the cell are formatted as "text".
I already tested vertical vectors instead of horizontals in the red area. They lead to the same situation.
NOTE:
I finally solved the original problem by using HLOOKUP() and VLOOKUP(). There I found another clue. Both show the same behaviour if [not_exact_match] is committed or set to true but work fine, if exact_match is enforced. So, how can Februar be an approximate match to Dezember?
See http://office.microsoft.com/en-gb/excel-help/lookup-function-HP010342671.aspx
For the LOOKUP function to work correctly, the data being looked up must be sorted in ascending order.
This is not the case with the texts "Dezember", "Januar", "Februar", ...
If you would use real dates 01.12.2013, 01.01.2014, 01.02.2014, ... and format them as "MMMM", then it should work. Of course the lookup_value also has to be in that form.
Same problem with VLOOKUP and not exact match. http://office.microsoft.com/en-gb/excel-help/vlookup-function-HP010343011.aspx
If range_lookup is either TRUE or is omitted, the values in the first column of table_array must be placed in ascending sort order; otherwise, VLOOKUP might not return the correct value.