Forum Discussion

amjadinsaudia's avatar
amjadinsaudia
Copper Contributor
Oct 10, 2023

Filtering Records Based On A Criteria Value

My requirement is to filter records based on a criteria value.

 

List of records in Column A (Filter range)

Criteria in Column B

Output in Column C

 

Criteria is sum of three different ranges in Column A

 

A VBA code is required  provide output in Column C that these values are equal or sum of criteria.

 

Filter RangeCriteriaOutput
13943232.83 
1386.64  
532  
26  
486  
220.66  
1062  
400  
126.27  
170  
3810  
700  
500  
22  
120  
230  
35.65  
421.74  
2129.56  
241.5  
234.78  

40 Replies

  • mathetes's avatar
    mathetes
    Silver Contributor

    amjadinsaudia 

     

    I think you need to add some clarity to your inquiry.

     

    When you say "Criteria is sum of three different ranges in Column A"  do you mean you want to find

    • any three cells in Column A where the sum equals the stated criterion, or
    • any three cells in Column A where the sum is less than or equal to the stated criterion, or
    • any three contiguous cells in Column A where the sum equals the stated criterion, or
    • any three contiguous cells in Column A where the sum is less than or equal to the stated criterion
    • or every combination of cells, be they contiguous or not...
    • etc

     

    What is the result supposed to look like? Identification of the cells in question? Just a series of totals meeting the criterion? Does the result have to be in column C?

     

    In short, your question raises more questions that need to be answered. Once you've answered them, you might have solved your own problem.

     

    • amjadinsaudia's avatar
      amjadinsaudia
      Copper Contributor

      mathetes

       

      any three contiguous cells ranges in Column A where the sum equals the stated criterion

       

      Just the series of values meeting the criterion.

       

      Result to be in Column C

       

      A more illustrated table is pasted here.

       

      Background of the problem:

      We have received payment form a customer who has many bills outstanding, may be hundreds of bills are outstanding. Upon receipt of payment, we need to identify bills those make sum of this payment which we received.

       

      Filter RangeCriteriaOutput 

      Cell

      Reference

      Cell Total
      13943232.83    
      1386.64     
      532     
      26     
      486   A6:A92168.66
      220.66   A15:A19829.39
      1062   A22234.78
      400    3232.83
      126.27     
      170     
      3810     
      700     
      500     
      22     
      120     
      230     
      35.65     
      421.74     
      2129.56     
      241.5     
      234.78     

       

      • peiyezhu's avatar
        peiyezhu
        Bronze Contributor
        3232.83:
        22,35.65,120,220.66,230,234.78,400,421.74,486,1062
        26,35.65,170,220.66,230,234.78,421.74,500,1394
        26,35.65,220.66,234.78,400,421.74,500,1394
        26,35.65,220.66,234.78,421.74,532,700,1062

        sum ?

Resources