Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Lenny
 
Posts: n/a
Default VLOOKUP loop multiple times

I am trying to help an Analyst at a police department. She is trying to
search crime data in Excel and put it into a calendar. I found an Excel
Calendar on Microsoft's web site, each day is one cell. I then put a
VLOOKUP formula that goes to another sheet and returns the crime based
on the date. i.e.

8/1/2005 FALSE INFO TO OFFICER
8/1/2005 N&D/PARAPHERNALIA
8/1/2005 MUNI CODE/SOLICIT W/O PERMIT
8/2/2005 ASSAULT WITH DEADLY WEAPON
8/2/2005 BATTERY/SIMPLE

The problem I can't figure out how to Loop the formula multiple times
and CONCATENATE the results so I can paste them back into the Cell that
contains the date.

Any Ideas?

Lenny

  #2   Report Post  
BenjieLop
 
Posts: n/a
Default


Lenny Wrote:
I am trying to help an Analyst at a police department. She is trying to
search crime data in Excel and put it into a calendar. I found an
Excel
Calendar on Microsoft's web site, each day is one cell. I then put a
VLOOKUP formula that goes to another sheet and returns the crime based
on the date. i.e.

8/1/2005 FALSE INFO TO OFFICER
8/1/2005 N&D/PARAPHERNALIA
8/1/2005 MUNI CODE/SOLICIT W/O PERMIT
8/2/2005 ASSAULT WITH DEADLY WEAPON
8/2/2005 BATTERY/SIMPLE

The problem I can't figure out how to Loop the formula multiple times
and CONCATENATE the results so I can paste them back into the Cell
that
contains the date.

Any Ideas?

Lenny


One way ...

ASSUME that the dates are entered in Column A and the corresponding
crime descriptions are in Column B.

If the date is entered in, say, Cell C1, enter this formula in Cell C2


=INDEX($B$1:$B$100,SMALL(IF($A$1:$A$100=C$1,ROW($B $1:$B$100)),ROW(1:1)))

and copy down to suit your requirements.

BTW, the above is an array, so use "Ctrl+Shift+Enter" (instead of
simply doing "Enter") in committing this formula.

Hope this is what you need.

Regards.


--
BenjieLop


------------------------------------------------------------------------
BenjieLop's Profile: http://www.excelforum.com/member.php...o&userid=11019
View this thread: http://www.excelforum.com/showthread...hreadid=471128

  #3   Report Post  
Lenny
 
Posts: n/a
Default

I don't think i explained it good enough let me try again.
In Sheet2 I have the following crime data and it could be a couple of
hundred rows

8/1/2005 FALSE INFO TO OFFICER
8/1/2005 N&D/PARAPHERNALIA
8/1/2005 MUNI CODE/SOLICIT W/O PERMIT
8/2/2005 ASSAULT WITH DEADLY WEAPON
8/2/2005 BATTERY/SIMPLE

I am in now back in Sheet1 Cell A1 I want a formula that will read
Sheet2 and Concatenate all the info for the first date like this into
one Cell
FALSE INFO TO OFFICER
N&D/PARAPHERNALIA
MUNI CODE/SOLICIT W/O PERMIT

I will write another formula that will put then data from the next date
into anohter cell untill I have all the data for the month.

I showed her how to do this with a pivot table but she wants it to look
like a calendar.

Thanks Again,
Lenny

  #4   Report Post  
Krishnakumar
 
Posts: n/a
Default


Hi Lenny,

Try,

In Sheet1 B1,

=SUBSTITUTE(aconcat(IF(Sheet2!A1:A5=A1,Sheet2!B1:B 5),", "),",
False","")

where A1 houses Date

Confirm with Ctrl+Shift+Enter

ACONCAT is a Function and below is the code;


Code:
--------------------
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
--------------------


HTH


--
Krishnakumar


------------------------------------------------------------------------
Krishnakumar's Profile: http://www.excelforum.com/member.php...o&userid=20138
View this thread: http://www.excelforum.com/showthread...hreadid=471128

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VLOOKUP and multiple columns Dan Belcher Excel Discussion (Misc queries) 6 September 17th 05 12:47 PM
how do I use vlookup for multiple occurrences of the same value Edith F Excel Worksheet Functions 15 April 29th 05 07:12 PM
how do I use vlookup for multiple occurrences of the same value bj Excel Worksheet Functions 0 April 27th 05 11:43 PM
Vlookup with multiple conditions cambrus Excel Worksheet Functions 1 March 11th 05 06:21 PM
Can VLOOKUP return multiple answers based on several identical lo. jddtct Excel Worksheet Functions 3 January 11th 05 08:03 AM


All times are GMT +1. The time now is 05:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"