Remove blank cells from if function

Trueblue862

Board Regular
Joined
May 24, 2020
Messages
160
Office Version
  1. 365
Platform
  1. Windows
I have this sheet below which pulls data from another sheet to produce a profit/loss report. Is there any way to adjust the formulas to condense the report down and remove the blank cells?

Stock List 1.6.xlsm
ABCD
1Profit ItemsProfit per ItemLoss ItemsLoss Per Item
2Apples (pink lady)$0.00  
3  Avocado-$100.00
4bananas (cavendish)$0.00  
5  bananas (sugar)-$75.00
6beans$0.00  
7  beetroot-$32.00
Profit or Loss
Cell Formulas
RangeFormula
A2:A7A2=IF(INDEX('Order Sheet'!$N:$N,ROW())>=0,INDEX('Order Sheet'!$A:$A,ROW()),"")
B2:B7B2=IF(INDEX('Order Sheet'!$N:$N,ROW())>=0,INDEX('Order Sheet'!$N:$N,ROW()),"")
C2:C7C2=IF(INDEX('Order Sheet'!$N:$N,ROW())<0,INDEX('Order Sheet'!$A:$A,ROW()),"")
D2:D7D2=IF(INDEX('Order Sheet'!$N:$N,ROW())<0,INDEX('Order Sheet'!$N:$N,ROW()),"")
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
So once you have the Table, it is possible to to summarize it in this way

Book1
ABCDEFGHI
1Profit ItemsProfit per ItemLoss ItemsLoss Per Item
2Apples200Apples200Avocado100
3Avocado100Banana500Bananas75
4Banana500Beans600Beetroot200
5Bananas75
6Beans600
7Beetroot200
8
9
10
11
12
13
Sheet2
Cell Formulas
RangeFormula
F2:I4F2=INDEX($A$1:$D$7,INT(AGGREGATE(15,6,IF($A$2:$D$7<>"",ROW($2:$7)*100+COLUMN($A:$D)),SEQUENCE(3,4))/100),MOD(AGGREGATE(15,6,IF($A$2:$D$7<>"",ROW($2:$7)*100+COLUMN($A:$D)),SEQUENCE(3,4)),100))
Dynamic array formulas.


But let me try to modify the formula
 
Upvote 0
Try these, I've set the formulas for data in the order sheet down to row 200, adjust as needed but realistically. Do not use entire columns anywhere that I have not already done so.

A2 =IF(A1="","",IFERROR(INDEX('Order Sheet'!$A:$A,AGGREGATE(15,6,ROW('Order Sheet'!$N$2:$N$200)/('Order Sheet'!$N$2:$N$200>0),ROWS(A$2:A2))),""))
B2 =IF(A2="","",SUMIFS('Order Sheet'!$N:$N,'Order Sheet'!$A:$A,A2))
C2 =IF(C1="","",IFERROR(INDEX('Order Sheet'!$A:$A,AGGREGATE(15,6,ROW('Order Sheet'!$N$2:$N$200)/('Order Sheet'!$N$2:$N$200>0),ROWS(C$2:C2))),""))
D2 =IF(C2="","",SUMIFS('Order Sheet'!$N:$N,'Order Sheet'!$A:$A,C2))
 
Upvote 0
Thank you, I’ll try them out tomorrow and let you know how I go.
 
Upvote 0
Something that I missed earlier, is it possible that an item could appear in both the Profit and Loss columns (as with bananas in your example)?
If it is possible then the formulas for columns B and D will need modifying slightly.
 
Upvote 0
No, it should be either profit or loss, the two bananas in my example are two different products. Thanks for your help, I’ll give it a try tomorrow.
 
Upvote 0
Try these, I've set the formulas for data in the order sheet down to row 200, adjust as needed but realistically. Do not use entire columns anywhere that I have not already done so.

A2 =IF(A1="","",IFERROR(INDEX('Order Sheet'!$A:$A,AGGREGATE(15,6,ROW('Order Sheet'!$N$2:$N$200)/('Order Sheet'!$N$2:$N$200>0),ROWS(A$2:A2))),""))
B2 =IF(A2="","",SUMIFS('Order Sheet'!$N:$N,'Order Sheet'!$A:$A,A2))
C2 =IF(C1="","",IFERROR(INDEX('Order Sheet'!$A:$A,AGGREGATE(15,6,ROW('Order Sheet'!$N$2:$N$200)/('Order Sheet'!$N$2:$N$200>0),ROWS(C$2:C2))),""))
D2 =IF(C2="","",SUMIFS('Order Sheet'!$N:$N,'Order Sheet'!$A:$A,C2))
Thank you for the time you've taken with this, it's not working for me. I'm not worried about messing with it anymore, it's at a point where the effort put in far exceeds the tiny bit of benefit received.
 
Upvote 0
We're not defeated that easily ;)
Could you give us a brief description of the actual v expected on the output?
 
Upvote 0
Thanks Jason, I’ll do up some examples in the next couple of days and post them up. I’m not going to get time to look at it today.
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

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