Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 240
  • Last Modified:

Lookup with count

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
Excellearner
Asked:
Excellearner
2 Solutions
 
StephenJRCommented:
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
 
barry houdiniCommented:
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now