Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Lookup with count

Posted on 2011-03-13
Medium Priority
238 Views
Dear experts,

Need a formulae, which will populate data from the sheet 'data' in to this sheet.

Sheet 'data' has two columns, variable and value.

The data under variable repeats and values are unique

In the sheet 'report' the variable is produced in column A, and the values are to placed adjacent one after the other, that the count 1 record is in column B(header count 1), and second count value in column C (header count 2) and so on.

If there is no variable, I need the formulae to leave the value in the cell to blank.

Kindly provide me an excel formulae, which can provide me the above soluation.

Thank you,

lookup-with-count.xls
0
Question by:Excellearner
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• Learn & ask questions

LVL 24

Assisted Solution

StephenJR earned 400 total points
ID: 35121982
Try this in B2 and copied down and across. Array formula so enter with Ctrl+Shift+Enter:

=IF(COLUMNS(\$B\$2:B2)<=COUNTIF(Data!\$A\$2:\$A\$13,\$A2),INDEX(Data!\$B\$2:\$B\$13,SMALL(IF(Data!\$A\$2:\$A\$13=\$A2,ROW(\$A\$2:\$A\$13)-ROW(\$A\$2)+1),COLUMNS(\$B\$2:B2)),1),"")
0

LVL 50

Accepted Solution

barry houdini earned 1600 total points
ID: 35122515
Stephen's formula is the best approach for data in any order....but if you have the variables in Data!A:A in blocks as per your example then you could use a simplified version, i.e. in B2 copied across and down

=IF(COLUMNS(\$B2:B2)>COUNTIF(Data!\$A:\$A,\$A2),"",INDEX(Data!\$B:\$B,MATCH(\$A2,Data!\$A:\$A,0)+COLUMNS(\$B2:B2)-1))

regards, barry
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
###### Suggested Courses
Course of the Month9 days, 19 hours left to enroll

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

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