Need help in coding

taruna1986

New Member
Joined
Feb 8, 2022
Messages
35
Office Version
  1. 365
Hi Admin,

I have the attached data and I'm trying to find the correct macro coding for creating my journal. I want if the account number & company code subtotal are zero then the macro would display the account number, profit center, and company code with value in other columns for a journal. Please advise.

1702957692417.png
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I don't think your question makes much sense, in conjunction with the image you are showing.
Can you shows us both a BEFORE and AFTER image (what your original data looks like, and what you want your final result to look like)?
 
Upvote 0
@Joe4 Sorry for not being clear in my request before. Please see attached the original and final results. I am looking for a macro that subtotal by account number & company code and if the amount is zero for the same then displays the columns given in the final results. Thanks for looking into this.

1703022137069.png
 
Upvote 0
OK, I am not understanding how you are arriving at your Final Results based on the original sample.
Why do you keep some records and dump others?

Perhaps you can walk us through the first few lines, and explain exactly how you arrive at the end result.
And explain why some records are left off altogether.
 
Upvote 0
OK, I am not understanding how you are arriving at your Final Results based on the original sample.
Why do you keep some records and dump others?

Perhaps you can walk us through the first few lines, and explain exactly how you arrive at the end result.
And explain why some records are left off altogether.
@Joe4 These are the steps, I want to add to the macro coding:
Step1: Check the subtotal value of account number & company code
Step 2: If it is zero then display the columns given in the final results
Step 3: If it is not zero then don't add it to the final results
In the above snip, the final results only show data where the subtotal of account number & company code is getting zero.
 
Upvote 0
@taruna1986 , you started a conversation that I couldn't reply to. Filter is not a formula. Select Amount Column, click on Data, click Filter. Then click the new down arrow in the Amount Column. In the dropdown, select number filters, then click Less Than. Type 0 in the box, then Okay. Or click Less than or equal to and type 0 in the box.
 
Upvote 0
Wouldn't a simple filter work?
@Skkybot
@taruna1986 , you started a conversation that I couldn't reply to. Filter is not a formula. Select Amount Column, click on Data, click Filter. Then click the new down arrow in the Amount Column. In the dropdown, select number filters, then click Less Than. Type 0 in the box, then Okay. Or click Less than or equal to and type 0 in the box.
It's not that easy, otherwise, I would have done it.
 
Upvote 0
taruna let's keep the ball rolling, the question I have is, below should be your input and output. Now I believe by your description of what you want, shouldn't company code 300 account number 1110100031 should equal 0 but it's not in your final result. Is this by design or did you miss it? Anyway your problem is now in a usable form so we may get some more help. In the mean time I will try and come up with a macro.


1703022137069.xlsx
ABCDEFGHI
1Before: Original DataAfter: Final results
2Company codeAccount NumberAmountProfit CenterCompany codeAccount NumberAmountProfit Center
3100111010001110,0003000/P1200001100111010001110,0003000/P1200001
41001110100011-10,0003000/P63000011001110100011-10,0003000/P6300001
5100111010001103000/P6700001100111010001103000/P6700001
610011101000313,8573000/P405000130011101000116,0003000/P4200001
710011101000314,0003000/P50000013001110100011-6,0003000/P6600001
810011101000313,8003000/P500002320011101000316,0003000/P4150001
930011101000116,0003000/P42000012001110100031-6,0003000/P5000002
103001110100011-6,0003000/P6600001200111010003103000/P5000200
11300111010003110,0003000/P3400001
123001110100031-10,0003000/P4200001
1330011101000316,5003000/P5000015
1430011101000313,8003000/P5000202
1520011101000113,8573000/P4150001
1620011101000114,0003000/P6310001
1720011101000113,8003000/P7000001
1820011101000316,0003000/P4150001
192001110100031-6,0003000/P5000002
20200111010003103000/P5000200
Data
 
Upvote 0

Forum statistics

Threads
1,215,212
Messages
6,123,654
Members
449,113
Latest member
Hochanz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top