Return values in order across multiple columns with criteria

Country_Calc_2

New Member
Joined
Sep 16, 2023
Messages
25
Office Version
  1. 365
Platform
  1. Windows
I am looking for a formula that will return values based on the order that they appear in Column A with the requirement that the country is skipped if the Column B value is 0.

This has to be done across multiple columns as in examples in Column D to K - because it is intended to be pasted into Word as a table with least possible vertical space.


Column AColumn BColumn DColumn EColumn FColumn GColumn HColumn IColumn JColumn K
CountryProjectsCountryProjectsCountryProjectsCountryProjectsCountryProjects
Argentina31Argentina
31​
Brazil
35​
China
9​
Egypt
2​
Armenia0Australia
80​
Bulgaria
30​
Colombia
15​
Estonia
10​
Australia80Austria
15​
Canada
107​
Costa Rica
1​
Denmark
24​
Austria15Belgium
46​
Chile
18​
Czechia
58​
Belarus0
Belgium46
Brazil35
Bulgaria30
Canada107
Chile18
China9
Colombia15
Costa Rica1
Croatia0
Czechia58
Denmark24
Dominican Republic0
Egypt2
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about
Fluff.xlsm
ABCDEFGHIJK
1CountryProjectsCountryProjectsCountryProjectsCountryProjectsCountryProjects
2Argentina31Argentina31Australia80Austria15Belgium46
3Armenia0Brazil35Bulgaria30Canada107Chile18
4Australia80China9Colombia15Costa Rica1Czechia58
5Austria15Denmark24Egypt2
6Belarus0
7Belgium46
8Brazil35
9Bulgaria30
10Canada107
11Chile18
12China9
13Colombia15
14Costa Rica1
15Croatia0
16Czechia58
17Denmark24
18Dominican Republic0
19Egypt2
Data
Cell Formulas
RangeFormula
D2:K5D2=LET(f,FILTER(A2:B100,B2:B100<>0),WRAPROWS(TOCOL(f),CEILING(ROWS(f)/2,2),""))
Dynamic array formulas.
 
Upvote 0
This sort of works except it puts the countries in order across columns instead of rows.

It also goes across too many columns to be practical for a Word paste.

I should have mentioned that I am limited to 8 columns total (or 4 columns of country names).

This is what it looks like on a larger dataset. I will see if I can tweak your formula.

Argentina
31​
Armenia
3​
Australia
80​
Austria
15​
Belarus
6​
Belgium
46​
Brazil
Estonia
10​
Finland
11​
France
106​
Georgia
28​
Germany
126​
Greece
4​
Guatemala
Lithuania
4​
Macedonia
4​
Malaysia
4​
Mexico
30​
Moldova
4​
Netherlands
82​
New Zealand
Serbia
33​
Singapore
7​
Slovakia
10​
South Africa
16​
Spain
123​
Sweden
31​
Switzerland
 
Upvote 0
This sort of works except it puts the countries in order across columns instead of rows.

It also goes across too many columns to be practical for a Word paste.

I should have mentioned that I am limited to 8 columns total (or 4 columns of country names).

This is what it looks like on a larger dataset. I will see if I can tweak your formula.

Argentina
31​
Armenia
3​
Australia
80​
Austria
15​
Belarus
6​
Belgium
46​
Brazil
Estonia
10​
Finland
11​
France
106​
Georgia
28​
Germany
126​
Greece
4​
Guatemala
Lithuania
4​
Macedonia
4​
Malaysia
4​
Mexico
30​
Moldova
4​
Netherlands
82​
New Zealand
Serbia
33​
Singapore
7​
Slovakia
10​
South Africa
16​
Spain
123​
Sweden
31​
Switzerland

Changing this part of the formula limits to the 8 columns I was looking for, but I do not understand how to change from columns to rows - "CEILING(ROWS(f)/10,2)"
 
Upvote 0
Ok, how about
Fluff.xlsm
ABCDEFGHIJK
1CountryProjectsCountryProjectsCountryProjectsCountryProjectsCountryProjects
2Argentina31Argentina31Brazil35China9Denmark24
3Armenia0Australia80Bulgaria30Colombia15Egypt2
4Australia80Austria15Canada107Costa Rica1
5Austria15Belgium46Chile18Czechia58
6Belarus0
7Belgium46
8Brazil35
9Bulgaria30
10Canada107
11Chile18
12China9
13Colombia15
14Costa Rica1
15Croatia0
16Czechia58
17Denmark24
18Dominican Republic0
19Egypt2
Data
Cell Formulas
RangeFormula
D2:K5D2=LET(f,FILTER(A2:B100,B2:B100<>0),r,CEILING(ROWS(f)/4,1),s,SEQUENCE(,8,0),IFERROR(INDEX(f,r*INT(s/2)+SEQUENCE(r),MOD(s,2)+1),""))
Dynamic array formulas.
 
Upvote 1
Solution
Ok, how about
Fluff.xlsm
ABCDEFGHIJK
1CountryProjectsCountryProjectsCountryProjectsCountryProjectsCountryProjects
2Argentina31Argentina31Brazil35China9Denmark24
3Armenia0Australia80Bulgaria30Colombia15Egypt2
4Australia80Austria15Canada107Costa Rica1
5Austria15Belgium46Chile18Czechia58
6Belarus0
7Belgium46
8Brazil35
9Bulgaria30
10Canada107
11Chile18
12China9
13Colombia15
14Costa Rica1
15Croatia0
16Czechia58
17Denmark24
18Dominican Republic0
19Egypt2
Data
Cell Formulas
RangeFormula
D2:K5D2=LET(f,FILTER(A2:B100,B2:B100<>0),r,CEILING(ROWS(f)/4,1),s,SEQUENCE(,8,0),IFERROR(INDEX(f,r*INT(s/2)+SEQUENCE(r),MOD(s,2)+1),""))
Dynamic array formulas.

This works perfectly, thanks so much.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,636
Members
452,662
Latest member
Aman1997

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