sum visible cell only

kelvin_9

Active Member
Joined
Mar 6, 2015
Messages
460
Office Version
  1. 2019
Hi All,

i'm writing below formula to calculate the sales in a column without duplicate order, but i was wondering how can this count visible cells only but not a whole column?

Excel Formula:
=SUM((FREQUENCY(IFERROR(MATCH(data!$A$2:$A$20000,data!$A$2:$A$20000,0),0)*(INT(data!$E$2:$E$20000)=$A52)*(E$50=data!$Y$2:$Y$20000),IFERROR(MATCH(data!$A$2:$A$20000,data!$A$2:$A$20000,0),0)*(INT(data!$E$2:$E$20000)=$A52)*(E$50=data!$Y$2:$Y$20000))>0)*1)-1

thanks for your guidance
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
The easiest way is to add a column on your sheet, say column Z. Put this formula in Z2:Z20000:

Excel Formula:
=SUBTOTAL(103,A2)

This will return a 1 if the row is visible, 0 if it is not. Then you can add another condition in your formula:

Excel Formula:
. . .  *($Z$2:$Z$20000=1)* . . .
 
Upvote 0
The easiest way is to add a column on your sheet, say column Z. Put this formula in Z2:Z20000:

Excel Formula:
=SUBTOTAL(103,A2)

This will return a 1 if the row is visible, 0 if it is not. Then you can add another condition in your formula:

Excel Formula:
. . .  *($Z$2:$Z$20000=1)* . . .
thank you very much for you reply, Eric W

this with ctrl shift enter?
Excel Formula:
=SUM((FREQUENCY(IFERROR(MATCH(data!$A$2:$A$20000,data!$A$2:$A$20000,0),0)*(INT(data!$E$2:$E$20000)=$A52)*(E$50=data!$Y$2:$Y$20000)*($AD$1:$AD$20000=1),IFERROR(MATCH(data!$A$2:$A$20000,data!$A$2:$A$20000,0),0)*(INT(data!$E$2:$E$20000)=$A52)*(E$50=data!$Y$2:$Y$20000))>0)*1)-1
 
Upvote 0
You can also avoid the helper column like this:

Excel Formula:
=SUM((FREQUENCY(IFERROR(MATCH(Data!$A$2:$A$20000,Data!$A$2:$A$20000,0),0)*(INT(Data!$E$2:$E$20000)=$A52)*(E$50=Data!$Y$2:$Y$20000)*SUBTOTAL(103,OFFSET(Data!$A$1,ROW(Data!$A$2:$D$20000)-ROW(Data!$A$1),0,1)),IFERROR(MATCH(Data!$A$2:$A$20000,Data!$A$2:$A$20000,0),0)*(INT(Data!$E$2:$E$20000)=$A52)*(E$50=Data!$Y$2:$Y$20000)*SUBTOTAL(103,OFFSET(Data!$A$1,ROW(Data!$A$2:$A$20000)-ROW(Data!$A$1),0,1)))>0)*1)-1
 
Last edited:
Upvote 0
You can also avoid the helper column like this:

Excel Formula:
=SUM((FREQUENCY(IFERROR(MATCH(Data!$A$2:$A$20000,Data!$A$2:$A$20000,0),0)*(INT(Data!$E$2:$E$20000)=$A52)*(E$50=Data!$Y$2:$Y$20000)*SUBTOTAL(103,OFFSET(Data!$A$1,ROW(Data!$A$2:$D$20000)-ROW(Data!$A$1),0,1)),IFERROR(MATCH(Data!$A$2:$A$20000,Data!$A$2:$A$20000,0),0)*(INT(Data!$E$2:$E$20000)=$A52)*(E$50=Data!$Y$2:$Y$20000)*SUBTOTAL(103,OFFSET(Data!$A$1,ROW(Data!$A$2:$A$20000)-ROW(Data!$A$1),0,1)))>0)*1)-1
thank you very much for your reply, felixstraube

something wrong?
apology i cant use xl2bb to copy the data here and photo instead while exceed 3000 cells limtitation

after filter col D E Y, i copied col A to another new sheet and remove duplicate, i found the answer is 58

but the formula return 10 only

5.jpg

thank you very much
 
Upvote 0
I'm trying with a some random data and it seems to work correctly.
Can you maybe share your file uploading it to a cloud storage? And I'll have a look.
 
Upvote 0
I'm trying with a some random data and it seems to work correctly.
Can you maybe share your file uploading it to a cloud storage? And I'll have a look.
thank you very much for your reply, felixstraube

this is my original workbook

i use my macro to run "136"
it return "10", but the correct answer should be "58"

also i run "simba"
it has somthing wrong which i am still thinking


thank you very much
 
Upvote 0
Hi Kelvin, sorry for the late response.
I think it is because you have data till row 38387, but your range goes from A2 to A20000. You should extend it to 38387.
Let me know it that fixes it.
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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