Link to home
Start Free TrialLog in
Avatar of Justincut
Justincut

asked on

IF (ISNA) question

Hi Guys, how do you turn this IFERROR formula into an IF(ISNA)?

=IFERROR(INDEX(Journals!P$5:P$1000,MATCH(TRUE,INDEX(Journals!B$5:B$1000=B572,0),0)),0)
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

=IF(ISNA(MATCH(TRUE,INDEX(Journals!B$5:B$1000=B572,0),0)),0,INDEX(Journals!P$5:P$1000,MATCH(TRUE,INDEX(Journals!B$5:B$1000=B572,0),0)))
Do you mind to post your sheet here? I want to show you somethings!
I just found you have some questions, I think this is one question!  I guess you are an accountant (same with me)!

Andrew
justincut,

I see you are building on/ using solutions provided in previous threads, can you please close those threads if they were met with your satisfaction.
I am also a bit confused on a previous thread where you provided an ISNA() type formula you asked how to shorten it.  I provided you an IFERROR() solution to do that.  Now you are asking for the reverse again.... I am kind of confused....
I agree with NB_VC. Perhaps you could give a wider explanation of what you are trying to do. Sometimes it's a good thing to split your requirement in to small chunks but sometimes (including here, I think) it would be beneficial if you try to explain your ultimate aim - there may be better ways than the way you are attempting.

I pointed this out in another thread but this construction:

=INDEX(Journals!P$5:P$1000,MATCH(TRUE,INDEX(Journals!B$5:B$1000=B572,0),0))

is almost always unnecessary. If you are looking up B572 in column B and returning a result from column P then a basic INDEX/MATCH to do that would be like this

=INDEX(Journals!P$5:P$1000,MATCH(B572,Journals!B$5:B$1000,0))

and if you want you can make that a VLOOKUP like this:

=VLOOKUP(B572,Journals!B$5:P$1000,15,0)

Now you can use ISNA round either of those, or even IFERROR, e.g. ISNA in conjunction with VLOOKUP

=IF(ISNA(VLOOKUP(B572,Journals!B$5:P$1000,15,0)),"",VLOOKUP(B572,Journals!B$5:P$1000,15,0))

regards, barry
me too
OK, sorry Justin, I was a little slow - you're using that construction because of the 255 character limit, I forgot about your previous thread.

...but that in itself is a good reason for a little more context - if you explain (briefly) what you are doing and why then you won't get idiots like me suggesting you change the formula for a different one!

So why ISNA rather than IFERROR, are you doing this in excel 2003 or is there another reason?

regards, barry
But, the isna() and iserror() really is some difference in the accounting point of view.
In the accounting point of view, isna() is not found (not included any errors), iserror() is included isna() and errors.
Avatar of Justincut
Justincut

ASKER

Hi Guys, the reason why I need an ISNA() instead of an ISERROR() is because I need to retrieve a "VALUE#" message when there is a Vlookup not working. The problem is the Vlookup Cell on one day has a Value with several trade IDs on it (eg. 5678910, 2467891, 5734789) and on the next day, due to  a system bug, the sequence of Trade IDs changes to (2467891, 5678910, 5734789) so although the contents of the cell is the same, its in a different sequence so the Vlookup does not work. If I use an Iserror, it hides the fact there is a problem whereas if I use ISNA, it shows VALUE# so I can see there is a problem. Has anyone got any idea how to make this cell of trade ids go in a numerical sequence so the Vlookup works. I am an accountant at a bank and I have to do a Rec comparing trades every day so I do a vlookup on the previous day to see if there is a break
As an example, assume that cell with multiple ID's in it is cell A9.

First, we will need to add a User Defined Function, for concatenating multiple values.

So go to the VB editor (Alt+F11), then Insert Module and paste this UDF:

Function aconcat(a As Variant, Optional sep As String = "") As String
' Harlan Grove, Mar 2002
Dim y As Variant

If TypeOf a Is Range Then
For Each y In a.Cells
aconcat = aconcat & y.Value & sep
Next y
ElseIf IsArray(a) Then
For Each y In a
aconcat = aconcat & y & sep
Next y
Else
aconcat = aconcat & a & sep
End If

aconcat = Left(aconcat, Len(aconcat) - Len(sep))
End Function

Open in new window


Then this formula will convert that string of ID's to a numerically ascending sequence in one step:

=aconcat(SMALL(TRIM(MID(SUBSTITUTE(A9,",",REPT(" ",100)),1+(100*(ROW(INDIRECT("1:"&LEN(A9)-LEN(SUBSTITUTE(A9,",",""))+1))-1)),100))+0,ROW(INDIRECT("1:"&LEN(A9)-LEN(SUBSTITUTE(A9,",",""))+1))),", ")

Open in new window


This will need to be confirmed with CTRL+SHIFT+ENTER.

The only issue is that it will need to be included at each function in your formula that will need to reference this to do the look up.

You can also place this formula in another cell on it's own, maybe adjacent to the original, and re-write the VLOOKUPs to reference that new cell with the sorted strings.

Will that help?
ASKER CERTIFIED SOLUTION
Avatar of byundt
byundt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial