View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default COMPLICATED VLOOKUP

I see the confusion Joel and also see I didn't really explain this completely
or well.

If all of column A values are stored as text values, then the formula as
written works fine. (and as I envisioned.) If the invoice numbers are
alpha or alpha numberic and stored as text or numberic and stored as text
then as in the example below

A111
A112
A113
A111, A113

then it works as written. =IF(COUNTIF(A:A,"*"&A2&"*")1,"Y","N")

If the invoice numbers are numeric and stored as numbers

111
112
113
111,113

then the invoice number itself will not be counted and you are correct that
the formula should use 0.
=IF(COUNTIF(A:A,"*"&A2&"*")0,"Y","N")

However, in this latter case, if only a single invoice is paid with a check,
then this will be problematic again if that invoice number is stored as
numeric. My advice would be to format Column A as Text and use the original
formula.

Does that clear it up. (thanks for pointing this out).

--
regards,
Tom Ogilvy





--
Regards,
Tom Ogilvy


"Joel" wrote:

Tom: 1 doesn't include 1.

"Tom Ogilvy" wrote:

It should be as I wrote it. It will count the original invoice, so it should
always be at least 1.

--
Regards,
Tom Ogilvy


"Joel" wrote:

Tom it should either be 0 or =1

"Tom Ogilvy" wrote:

in the paid column (assume that is D)

d2: =if(countif(A:A,"*"&A2&"*")1,"Y","N")

This assumes that your invoice numbers are unique. In otherwords if your
invoice numbers were

1
5
10
5,10

then the formula in D2 would match the 1 found in the string in 5,10 to the
first invoice number (1) which would be incorrect. This isn't a problem if
you have invoice numbers like

111
112
113
114
112,114

where one invoice number is not a subset of another invoice number.

--
Regards,
Tom Ogilvy


"shaqil" wrote:

Dear All,

I have the data in following format:

Invoice # Chq # Amount Paid
1 10
2 20
3 30
1,3 987 40

I want to lookup the invoice # which has been paid thru chq and mark
"Y" in Paid column. In above example invoice # 1 and 3 has been paid
thru Chq # 987 so they should be marked "Y".

Can anybody help me?

Thnx in advance.