Help with challenging formula

Copper Contributor

Hello!

I need help figuring out how to get a formula to work and was counting on this community's expertise!

 

I basically have a table with ticket items where one of the columns for each ticket is called Linked Issues. 

If an item from my table is listed as "Bug" then we should look at the Linked Issues column and see if any of those comma-separated items are also listed in the table as "Story". If this criterion is met then my bug counts as one. Otherwise, it's a zero.

One last criterion is that another column must also contain a "Yes", otherwise this Bug won't be accounted for in my total.

 

I've attached a file with an example and a detailed explanation. With help, in the past, I've made this work in Google Sheets but it uses formulas such as "regexmatch" and "arrayformula" to make the calculation.

It's been a challenge to solve this Excel so any help would be greatly appreciated!

Thank you very much!

 

12 Replies

@ragomes1972 

Try this:

=((B2="Bug")*(F2="Yes")*IFERROR(SUM(--(IF(($C$2:$C$16=TRANSPOSE(FILTERXML("<y><z>"&SUBSTITUTE(E2,";","</z><z>")&"</z></y>","//z"))),$B$2:$B$16)="Story")),0))>0

Thanks, @Detlef Lewin!
Sorry, I wasn't clear enough in my previous explanation. What I'm actually trying to figure out is one single formula that gives me the total number of rows that meet the criteria.
I've reviewed the Excel sheet and attached it again for more clarity.
Please let me know if you can help me out.
Much appreciated!

@ragomes1972 

In that case I would suggest a Power Query solution.

 

Thanks @Detlef Lewin! But I'm afraid I can't use a Power Query solution due to the fact that my table is overwritten on an hourly basis with data coming from a database. It's always written with the same columns but whatever I had there before in terms of content and formatting gets deleted once the new data comes in.
The formula I'm looking for would be on a separate tab and as long as there's data to read from it calculates the total number of tickets from the table that matches my criteria. Hence why it needs to be one formula.
If the formula was done in google sheets before, I must believe there's a way to do it in Excel but since the formula does not translate exactly to Excel, it's been a big challenge.

The formula I had in Google Sheets before is as follows (not sure if it's helpful at all but at least for reference):
=arrayformula( sum( iferror( regexmatch( filter(INDIRECT("'JQL - Sprint "& A4 & "'!S2:S"), len(INDIRECT("'JQL - Sprint "& A4 & "'!S2:S")), INDIRECT("'JQL - Sprint "& A4 & "'!B2:B") = "Bug") & ";", textjoin( "|", true, filter(INDIRECT("'JQL - Sprint "& A4 & "'!C2:C"), len(INDIRECT("'JQL - Sprint "& A4 & "'!C2:C")), INDIRECT("'JQL - Sprint "& A4 & "'!B2:B") = "Story") & ";" ) ) + 0 ) ) )

Let me know your thoughts.
Thanks again!

@ragomes1972 

But I'm afraid I can't use a Power Query solution due to the fact that my table is overwritten on an hourly basis with data coming from a database. It's always written with the same columns but whatever I had there before in terms of content and formatting gets deleted once the new data comes in.


Then PQ seems to be the best choice.

 

 

@ragomes1972  It isn't pretty but this formula will give you a helper column to determine if that row meets the criteria:

=LET(in,E2,lenIN,LEN(in),xploded,SUBSTITUTE(in,";",REPT(" ",lenIN)),n,IFERROR(CEILING.MATH(LEN(xploded)/lenIN,1),0),list,IF(n,TRIM(MID(xploded,SEQUENCE(n,,1,lenIN),lenIN)),""),storys,FILTER(C:C,B:B="Story"),st_true,OR(IFERROR(MATCH(list,storys,0)>0,FALSE)),b_true,AND(B2="Bug",F2="Yes",st_true),--b_true)

see attached

 

Thanks, @mtarler!
This is great but I'm wondering if there's a way to achieve the result without the use of a helper column or table through a single formula.
Let me know if you have any thoughts on that.
I truly appreciate your time to help with this!

Here's why I can't use a helper column - I've attached two screenshots that show:

  • tabs for each Sprint that contains data being pulled from a Jira database. For example: "JQL - Sprint 27" pulls data for sprint 27 from Jira
  • The "Unplanned Work" tab:
    • Notice how this tab presents a table where each role is looking to pull data from its specific Sprint tab (the ones that automatically pull data from Jira database) to come up with a total number of bug tickets that are story (feature) related.

So what I need is a formula that goes on column F for each role, looks at the respective Sprint tab and presents the total of tickets that match the criteria.

 

This is why I can't use a helper table or a helper column and need a single formula to do the job:

  • the data from the sprints tab gets completely overwritten every hour and any previous data gets erased - so using a helper table or column here wouldn't work because that would be overwritten.

I hope this clarifies the scope of my question. The sample sheet I provided in this thread was a short version of the original one, which may lead to think I can make use of other Excel features such as Power Query, helper tables, etc. when all I need is a single formula. 

Don't want to seem demanding or anything but thought I'd clarify the question to eliminate confusion and not waste your time on the wrong path.

 

Thank you!

 

 

I get that the table gets overwritten each time, but the helper column could be on a completely different sheet/tab. That said, I'm sure there is some way to make it into a single formula, it would just take some time for me to figure it out (others here may do it much faster)
Thanks, @mtarler.
Yeah, I understand the suggestion but I'd have to manually create a user column for every new sprint, which defeats the purpose of making it automated. Besides, wherever those columns would sit within the spreadsheet, imagine having dozens of helper columns there that keep growing indefinitely - especially because the spreadsheet is already pretty large.
I can't believe the formula was so easily created in Google Sheets thou. Hopefully, I'll find an equivalent single formula in Excel like I had in Google Sheets...

@ragomes1972 

The idea of the solution shown in the image is to filter the dataset and than count the number of rows returned

image.png

The formula is specific to Excel 365 but I have avoided the most recent functionality on beta release.

= LET(
  links, ISNUMBER(SEARCH(TRANSPOSE(Ticket&";"), linked&";")),
  linkStatus, N((Issue_Type)="Story"),
  eachLink, N(ISTEXT(Ticket)),
  linkFilter, MMULT(links*1, linkStatus)>0,
  bugFilter, Issue_Type="Bug",
  commentFilter, Sprint_Commit="Yes",
  combined, bugFilter*commentFilter*linkFilter,
  required, FILTER(Table1, combined),
  ROWS(required))

. The first steps analyse the linked issues and gather the results as a matrix multiplication.  Later the entire table is filtered and could be output to the sheet if required (it requires only a single cell for the formula, just as the count, but will spill to an adjacent range).

I notice that the 'eachLink' line is an unused left-over. I could try to edit the post but that tends to create a mess and I think this forum does not allow posts to be deleted for rework.

I would also note that the Excel preferred option for importing data is via PowerQuery which supports data manipulation to clean and combine data before it even appears on the spreadsheet.