Sum numbers only if texts in another column is consecutive

helpmeexcelgods

New Member
Joined
Sep 29, 2021
Messages
2
Office Version
  1. 2019
  2. 2016
  3. 2010
Platform
  1. Windows
Hi all,

I am trying to calculate the amount per qty (column F). Problem is that some countries have both import and export, while some only have one way (either import or export); hence when I drag down the formula in cell F2, the formula in cell F4 automatically includes the amount for the next country.

May I know if there is any formula for me to calculate the amount per qty for each country, without having to edit each entry manually?
ABCDEF
1
Country
Type
Amount ($)
Qty
Amount Per Qty
2Argentina
Import​
5​
3​
=(D2+D3)/E2
3
Export​
10​
#DIV/0!​
4Mexico
Import​
3​
5​
=(D4+D5)/E4
5Ireland
Import​
5​
6​
6
Export​
6​
7Indonesia
Import​
7​
5​
8
Export​
4​
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
@helpmeexcelgods Maybe like this?

Bridal Stuff2.xlsx
BCDEFG
1CountryTypeAmount ($)QtyAmount Per QtyOR
2ArgentinaImport5355
3Export10  
4MexicoImport350.60.6
5IrelandImport561.81.8
6Export6  
7IndonesiaImport752.22.2
8Export4  
USD
Cell Formulas
RangeFormula
F2:F8F2=IF(E2="","",IF(E3="",(D2+D3)/E2,D2/E2))
G2:G8G2=IF(B2="","",IF(B3="",(D2+D3)/E2,D2/E2))


Hope that helps.
 
Upvote 0
@helpmeexcelgods Maybe like this?

Bridal Stuff2.xlsx
BCDEFG
1CountryTypeAmount ($)QtyAmount Per QtyOR
2ArgentinaImport5355
3Export10  
4MexicoImport350.60.6
5IrelandImport561.81.8
6Export6  
7IndonesiaImport752.22.2
8Export4  
USD
Cell Formulas
RangeFormula
F2:F8F2=IF(E2="","",IF(E3="",(D2+D3)/E2,D2/E2))
G2:G8G2=IF(B2="","",IF(B3="",(D2+D3)/E2,D2/E2))


Hope that helps.
Hi it works great. Thanks for your help!
 
Upvote 0

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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