# Use of list indexes

Hi, good afternoon.
I was trying to extract some information from a list, but I was not able to. Hope that someone can bring some lights to this problem.

I have a list with some data from a table and I want to extract all the dates that are before the "Captured" and "Authed". I am having problems when there are more than one of the same status.

Thank you in advance for the help

{A=["1/8/21 at 2:40pm EST", "Authed", "\$109.01", "1/9/21 at 10:05am EST", "Voided", "(\$109.01)", "1/9/21 at 10:05am EST", "Captured", "\$109.01", "1/9/21 at 10:05am EST", "Captured", "\$50.00"]}{=A}
{lv=location(A, "Voided")}{Vd=A[lv-1]}{=Vd}
{lc=location(A, "Captured")}{Cd=A[lc-1]}{=Cd}
{F=[x=="Captured" for x in A]}{=F}

Hi, I just want to mention that I was able to extract the indexes of the dates, but I am not able to use this indexes to extract the information from the list A, here is the formula that I used to extract the indexes.

{=[index-1 for (x, index) in a if x == "Captured"]}

I think you are very close. Something like this might work:

{A=["1/8/21 at 2:40pm EST", "Authed", "\$109.01", "1/9/21 at 10:05am EST", "Voided", "(\$109.01)", "1/9/21 at 10:05am EST", "Captured", "\$109.01", "1/9/21 at 10:05am EST", "Captured", "\$50.00"]}

{=[a[index-1] for (x, index) in a if x == "Captured" or x == "Authed"]}

Awesome, I am going to try that, thank you :3

Another quick question, there is a way to exctract multiple indexes from a list? for example id I want to extract from the 3th index to the 6th, Is there a way to do that?

Sure, that is pretty straightforward:

{list=["A", "B", "C", "D" , "E", "F", "G", "H", "I"]}
{indexes=[1, 3, 6]}
{=[list[index] for index in indexes]}

OMG you are awesome, Thank you very much for the help