Solved

Populate data based ona  criteria

Posted on 2016-12-01
6
35 Views
Last Modified: 2016-12-01
Hi,

Below is the table i am working with. i 'd like to populate data in cell c1, c2, c3, c4 based on a criteria. For example: If the criteria is 4 i want cells C1,C2,C3,C4 to display 11,23,304,40 respectively and not show anything in c5,c6.... and so on.

Is there a formula that can generate this result? Thanks

Column A Column B
Date             Sales
1/2/2016     11
1/9/2016     23
1/16/2016   304
1/23/2016   40
1/30/2016   50
2/7/2016    60
2/14/2016   70
2/21/2016   80
2/28/2016   90
3/7/2016    100
0
Comment
Question by:Dokat
  • 3
  • 3
6 Comments
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 41909462
So you want only the first X number of records listed in column C?

Assuming the table headers are in Row 1 and the criteria is in cell G1, you can use this formula copied down as required....

=IF(ROW()<G$1+2, B2, "")
0
 

Author Comment

by:Dokat
ID: 41909477
Hi Wayne,

Thanks for your response. This formula only populate if the row number is greater than G1+2. what if it is less than G1+2?

Thanks for your response?
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 41909494
This formula only populate if the row number is greater than G1+2. what if it is less than G1+2?

No, "<" = less than. For example, if G1 = 4, rows 2 to 5 will be shown. If G1 = 15, rows 2 to 16 will be shown.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Closing Comment

by:Dokat
ID: 41909652
Thank you for your help!
0
 

Author Comment

by:Dokat
ID: 41909655
Your previous solution worked. however what if i want cells to display C1,C2,C3,C4 to display 70,80,90,100 respectively when G1=4 or C1,C2,C3,C4,C5 to display 60,70,80,90,100? basically last 4 or 4 rows of data rather than the first 4 or 5 rows?

Thank you so much for your help
0
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 41909684
A bit more complicated, but this formula in cell C1 copied down will give what you request...

=IF(ISBLANK(INDEX(B:B, COUNTA(A:A)-G$1+ROW())), "", INDEX(B:B, COUNTA(A:A)-G$1+ROW()))
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
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…

911 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

19 Experts available now in Live!

Get 1:1 Help Now