+ Reply to Thread
Results 1 to 11 of 11

Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewise

  1. #1
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewise

    Hi,

    I am trying to prepare a report that will keep only the positive value after removing/adjusting/adding negative values to positive value either full or partial or more than one or only one.

    The logic behind is that any negative values must be setoff with every positive value on FIFO basis i.e taken datewise ascending order or ID in ascending order.

    Sample Raw data with expected result two visible worksheet is attached for your kind reference.

    I want the result of F column which is highlighted with yellow.

    Macro or some VBA if possible would speedup the task as this is of one customer. However,I have many say more than 1 k.
    Attached Files Attached Files
    Last edited by paradise2sr; 03-29-2023 at 06:58 AM.

  2. #2
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Not too sure, but your data already sorted in ascending mode, both for date and ID, so the statement :
    Quote Originally Posted by paradise2sr View Post
    ... on FIFO basis i.e taken datewise ascending order or ID in ascending order. ...
    is meaningless here.

    Please Login or Register  to view this content.
    1. I care dog
    2. I am a loop maniac
    3. Forum rules link : Click here
    3.33. Don't forget to mark the thread as solved, this is important

  3. #3
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Thanx for your kind response.It seems to work in those stated columns presented as expected.

    Since the demo data was infact was the reduced version of unnecessary columns of real data and was not sure would arrive at the solution.

    I have added my original structure of data.I have hidden certain columns in order to avoid confusion. You may unhide for your kind reference.

    Can you kindly restate the # Post 2 code in the enclosed data structure.

    I want the result in J column which currently as per your code displaying in H column subject to slight change in structure of #Post1 attachment.
    Attached Files Attached Files

  4. #4
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    You are welcome.

    The adjusted code should be like this :
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Thanx a lot. Wonderfully worked for a single customer.

    Indeed a great respect to you.

    One last things, this structure was of a single customer. How the same things can be achieved in K column if I have multiple customers.
    With the tweaks is that a customer name is assigned manually in H column now and I & J columns are similar to the earlier posts.

    So,I want H,I,J columns through vba code (which is currently mentioned manually & by formula) and of course K column expected result of previous post.

    Since change in customer indicates change in adjustment as well as highlighted in H column are the unique data to the left hand side.

    I hope,you will sort out the issue in case multiple customer case.I have simply presented for 4 customers only.There are infact more than 1k customers and data lies just below.
    Attached Files Attached Files

  6. #6
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Hi,karedog,Is there any updates to the Post #5.
    Basically, I am trying to build agewise report say for each customer for eg.<=30, 30 to 60 days,60 to 90 days,90 to 120 days,120 to 150 and above 150 days,etc.

    For single case you have already helped me which is highly appreciated .

    Now,I stumbled into multiple case as stated in Post#5.
    I cannot post in separately becoz it would be a duplicate post and is inter related to this post.

    If u require any further information regarding post 5.Kindly let me know.
    Last edited by paradise2sr; 03-30-2023 at 10:00 PM.

  7. #7
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Thanks 👍. Perfectly worked as expected.I have tested more than 10k data.Thanx a lot.

  9. #9
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Hi,can you change the line of code of 5th line"Sheet1" .I want to use in any worksheet and not specific one i.e to be more flexible in any sheet working.Simply run the macro and remaining process that I can do at my end.

  10. #10
    Forum Guru karedog's Avatar
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,971

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    You are welcome, thanks for marking the thread as solved and rep.points given.

    The adjusment is :
    Please Login or Register  to view this content.
    Regards

  11. #11
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Remaining positive value after adjustment of negative value on 1st come 1st i.e Agewis

    Thanx with your kind help,I am able to proceed to final step.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Random selection from remaining items, volatile manual adjustment
    By Marbleking in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2021, 12:24 PM
  2. Calculate cost basis of remaining shares of stock
    By fpt264 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-09-2020, 08:32 AM
  3. Convert negative to positive in sheet containing both positive/negative numbers
    By sa02000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2010, 07:52 PM
  4. Replies: 1
    Last Post: 08-14-2009, 11:17 AM
  5. Replies: 1
    Last Post: 11-20-2008, 01:52 AM
  6. Replies: 2
    Last Post: 11-13-2008, 12:35 AM
  7. Replies: 4
    Last Post: 09-26-2005, 06:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1