Solved

IF (ISNA) question

Posted on 2013-12-05
13
157 Views
Last Modified: 2013-12-07
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)
0
Comment
Question by:Justincut
  • 5
  • 3
  • 2
  • +3
13 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
Comment Utility
=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)))
0
 
LVL 4

Expert Comment

by:andrew_man
Comment Utility
Do you mind to post your sheet here? I want to show you somethings!
0
 
LVL 4

Expert Comment

by:andrew_man
Comment Utility
I just found you have some questions, I think this is one question!  I guess you are an accountant (same with me)!

Andrew
0
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
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.
0
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
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....
0
 
LVL 50

Expert Comment

by:barry houdini
Comment Utility
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
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 4

Expert Comment

by:andrew_man
Comment Utility
me too
0
 
LVL 50

Expert Comment

by:barry houdini
Comment Utility
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
0
 
LVL 4

Expert Comment

by:andrew_man
Comment Utility
But, the isna() and iserror() really is some difference in the accounting point of view.
0
 
LVL 4

Expert Comment

by:andrew_man
Comment Utility
In the accounting point of view, isna() is not found (not included any errors), iserror() is included isna() and errors.
0
 

Author Comment

by:Justincut
Comment Utility
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
0
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
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?
0
 
LVL 80

Accepted Solution

by:
byundt earned 500 total points
Comment Utility
I like NB_VC's suggestion of using a user-defined function to concatenate the string--but the sorting feature should be added to the UDF. That way, you won't need the array formula.

The UDF below should be pasted on a regular module sheet (just like a macro). It returns the values in the input parameters separated by commas and arranged in ascending order. You can then use it in a worksheet formula like:
=ConcatInOrder(E2,J2,I2,M2,V2)
Function ConcatInOrder(ParamArray vData() As Variant) As String
Dim v As Variant, vSorted As Variant
Dim i As Long, j As Long, n As Long
Dim bSorted As Boolean
Dim s As String, sep As String
sep = ","      'Separator between items in list
ReDim vSorted(1 To UBound(vData))
For Each v In vData
    If v <> "" Then
        n = n + 1
        vSorted(n) = v
    End If
Next
If n > 1 Then
    For i = 1 To n
        bSorted = True
        For j = 2 To n
            If vSorted(j) < vSorted(j - 1) Then
                v = vSorted(j - 1)
                vSorted(j - 1) = vSorted(j)
                vSorted(j) = v
                bSorted = False
            End If
        Next
        If bSorted = True Then Exit For
    Next
End If
For i = 1 To n
    s = s & sep & vSorted(i)
Next
ConcatInOrder = Mid$(s, Len(sep) + 1)
End Function

Open in new window

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Drop Down List with Unique/Distinct Values (Part II - ComboBox or ListBox and Data Validation List Bonus!) David Miller (dlmille) Intro This article focuses on delivering unique, sorted lists to list objects (e.g., ComboBox, ListBox) and Dat…
Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now