Forum Discussion

SandeepDaga's avatar
SandeepDaga
Copper Contributor
May 06, 2024

Map invoice and receipt on FIFO basis

Hi, i am attaching a sample data below, in which i have amounts in Positive as Invoices raised and Negative Values as Amount received, now i want to map receipts against invoice documents on FIFO basis.

 

format of desired output is as below.

 

 

Kindly help.

 

6 Replies

  • dscheikey's avatar
    dscheikey
    Bronze Contributor

    SandeepDaga 

     

    Hi, I have tried to understand your task and have developed a formula that works under Office 365. But I'm not sure if it fits.

     

    Document NoDocument DateDocument TotalsAdjusted AmountAdjusted Document NoAdjusted Date
    111/26/22737429   
    211/30/22809893   
    301/27/23281682   
    401/31/23348288   
    503/31/23599277   
       -400000604/03/23
    704/05/23200000   
       -162594804/06/23
       -400000904/17/23
       -9299.811004/21/23
       -1000001104/24/23
       -1000001204/26/23
       -1000001305/04/23

     

     

    =LET(
     data,SORT(A2:C14,2),
     totals,C2:C14,
       VSTACK(
          HSTACK(A1:C1,"Adjusted Amount","Adjusted Document No","Adjusted Date"),
          HSTACK(IF(totals>0,data,""),CHOOSECOLS(IF(totals<0,data,""),3,1,2)
          )
       )
    )

     

     

    • SandeepDaga's avatar
      SandeepDaga
      Copper Contributor

       

      Hi dscheikey 
      Thanks you so much for your efforts, but as per output in your sheet, positives and negatives columns have been separated, but my desired output is to map negative amounts against positive amounts on FIFO basis, each negative line item needs to be mapped against a positive line to the extent of positive amount on FIFO basis in the way below

       

       

      Regards

      Sandeep Daga

       

       

      • dscheikey's avatar
        dscheikey
        Bronze Contributor

        SandeepDaga 

        I'm sorry. I don't understand it. Maybe you could explain what FIFO is first. I would have translated it as First in First out. Is that correct? Why does position number 9 exist twice? Once positive and once negative? What do you mean mapping? Number 9 is -400000 in the first List! Please explain the logic of your comparison in more detail.

         

Resources