{"id":3938,"date":"2017-04-13T17:00:50","date_gmt":"2017-04-13T15:00:50","guid":{"rendered":"https:\/\/www.sheetgo.com\/?p=3938"},"modified":"2017-04-13T17:00:50","modified_gmt":"2017-04-13T15:00:50","slug":"formula-array_constrain-google-sheets","status":"publish","type":"post","link":"https:\/\/www.sheetgo.com\/pt\/blog\/google-sheets-formulas\/array_constrain-formula-google-sheets\/","title":{"rendered":"Como usar a f\u00f3rmula ARRAY_CONSTRAIN no Planilhas Google"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; admin_label=&#8221;section&#8221; module_class=&#8221;sheetgo-post&#8221; _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_row admin_label=&#8221;row&#8221; _builder_version=&#8221;4.16&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;|||&#8221; global_colors_info=&#8221;{}&#8221; custom_padding__hover=&#8221;|||&#8221; theme_builder_area=&#8221;post_content&#8221;][et_pb_text _builder_version=&#8221;4.16&#8243; custom_padding=&#8221;||0px|||&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>In Google Sheets, the<span>\u00a0<\/span><a href=\"https:\/\/support.google.com\/docs\/answer\/3267036?hl=en\" target=\"_blank\" rel=\"noopener noreferrer\">ARRAY_CONSTRAIN<\/a><span>\u00a0<\/span>formula returns a subset of the input range, characterized by the specified number of rows and columns. In other words, the formula restricts or constraints the size of input range by the specified number of rows and columns.<\/p>\n<h3>Syntax<\/h3>\n<p><span><strong>ARRAY_CONSTRAIN(input_range, num_rows, num_cols)<\/strong><\/span><\/p>\n<ul>\n<li><span><strong>input_range<\/strong><\/span><span>\u00a0<\/span>\u2013 can either be an address reference to the range of cells that we need to constrain, or an output range derived from another formula.<\/li>\n<li><span><strong>num_rows<\/strong><\/span><span>\u00a0<\/span>-is the number of rows the constrained should contain.<\/li>\n<li><span><strong>num_cols<\/strong><\/span><span>\u00a0<\/span>\u2013 is the number of columns the constrained output should contain<\/li>\n<\/ul>\n<p>[\/et_pb_text][et_pb_text admin_label=&#8221;Connections T &#8211; Automate beyond importrange &#8211; Horizontal&#8221; module_class=&#8221;sheetgo-post-no-shadow-img md2-contained-button-light vertical-banner-container&#8221; _builder_version=&#8221;4.27.2&#8243; _module_preset=&#8221;default&#8221; background_color=&#8221;#f2f7ff&#8221; max_width=&#8221;700px&#8221; module_alignment=&#8221;center&#8221; max_height=&#8221;300px&#8221; custom_margin=&#8221;20px|0px|20px|0px|true|true&#8221; custom_padding=&#8221;25px|25px|25px|25px|true|true&#8221; sticky_limit_bottom=&#8221;section&#8221; border_radii=&#8221;on|20px|20px|20px|20px&#8221; border_width_all=&#8221;1px&#8221; border_color_all=&#8221;#d9e7ff&#8221; saved_tabs=&#8221;all&#8221; global_colors_info=&#8221;{}&#8221; global_module=&#8221;50462&#8243; theme_builder_area=&#8221;post_content&#8221;]<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2024\/09\/Add-on-sm_sheets-connected-new-connection.webp\" width=\"250\" height=\"168\" alt=\"\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2024\/09\/Recommended-for-Google-Workspace-badge.webp\" width=\"150\" height=\"180\" alt=\"39\" \/><\/p>\n<p><span style=\"font-size: 22px; font-weight: 600;\">Automate data transfers beyond Importrange<\/span><\/p>\n<p><a href=\"https:\/\/www.sheetgo.com\/connections\/\" target=\"_blank\" rel=\"noopener\">Find out how<\/a>[\/et_pb_text][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<h3>Usage: ARRAY_CONSTRAIN Formula<\/h3>\n<p>Examples always help us digest the concepts better. Following is a sample data set on which we will try the ARRAY_CONSTRAIN formula.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/ARRAY_CONSTRAIN-formula-1.png&#8221; alt=&#8221;ARRAY_CONSTRAIN formula 1&#8243; title_text=&#8221;ARRAY_CONSTRAIN formula 1&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>Now, we keyed in the formula in cell H1, as shown in the snapshot below.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/ARRAY_CONSTRAIN-formula-2.png&#8221; alt=&#8221;ARRAY_CONSTRAIN formula 2&#8243; title_text=&#8221;ARRAY_CONSTRAIN formula 2&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>The<span>\u00a0<\/span><span><strong>input_range<\/strong><\/span><span>\u00a0<\/span>is A1<g class=\"gr_ gr_40 gr-alert gr_gramm gr_inline_cards gr_run_anim Style replaceWithoutSep\" id=\"40\" data-gr-id=\"40\">:G10<\/g>, while the size defining parameters<span>\u00a0<\/span><span><strong>num_rows<\/strong><\/span><span>\u00a0<\/span>and<span>\u00a0<\/span><span><strong>num_columns<\/strong><\/span><span>\u00a0<\/span>are 7 and 4 respectively. We see that the output consists of 7 rows and 4 columns, exactly as we defined. It ignored the data falling beyond row 7 and column 4.<\/p>\n<p>The output data<span>\u00a0<\/span><g class=\"gr_ gr_43 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar multiReplace\" id=\"43\" data-gr-id=\"43\">flows<\/g><span>\u00a0<\/span>from H1 towards<span>\u00a0<\/span><g class=\"gr_ gr_42 gr-alert gr_gramm gr_inline_cards gr_run_anim Grammar only-ins replaceWithoutSep\" id=\"42\" data-gr-id=\"42\">right<\/g><span>\u00a0<\/span>and further down. So, it is very important that we keep the cells, where we expect the data to flow, clear of any values. Otherwise, the formula returns #REF! error, as demonstrated in the screenshot below.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/ARRAY_CONSTRAIN-formula-3.png&#8221; alt=&#8221;ARRAY_CONSTRAIN formula 3&#8243; title_text=&#8221;ARRAY_CONSTRAIN formula 3&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>Suppose that we need only the Vegetables\u2019 data corresponding to Energy column only. Here\u2019s how we can get creative with the formula.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/ARRAY_CONSTRAIN-formula-4.png&#8221; alt=&#8221;ARRAY_CONSTRAIN formula 4&#8243; title_text=&#8221;ARRAY_CONSTRAIN formula 4&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p>Unlike the previous example, we have entered the formula in H2 here. We considered only the data rows and not the header. The<span>\u00a0<\/span><a href=\"https:\/\/www.sheetgo.com\/blog\/google-sheets-formulas\/filter-formula-google-sheets\/\" target=\"_blank\" rel=\"noopener noreferrer\">FILTER formula<\/a><span>\u00a0<\/span>evaluated the range for the first parameter, whereas the<span>\u00a0<\/span><a href=\"https:\/\/support.google.com\/docs\/answer\/3093480?hl=en\" target=\"_blank\" rel=\"noopener noreferrer\">COUNTIF<\/a><span>\u00a0<\/span>formula determined the value for the second parameter.<\/p>\n<p>To take this even further we can try this formula on the \u2018data import\u2019 related functions as well. For example, here is how a normal IMPORTDATA would have looked like.<\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/ARRAY_CONSTRAIN-formula-5.png&#8221; alt=&#8221;ARRAY_CONSTRAIN formula 5&#8243; title_text=&#8221;ARRAY_CONSTRAIN formula 5&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][et_pb_text _builder_version=&#8221;4.16&#8243; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;]<\/p>\n<p><span>In the snapshot below, we embedded this within the ARRAY_CONSTRAIN formula. And, we constrained the data to 10 rows and 10 columns.<\/span><\/p>\n<p>[\/et_pb_text][et_pb_image src=&#8221;https:\/\/static.sheetgo.com\/wp-content\/uploads\/2021\/10\/ARRAY_CONSTRAIN-formula-6.png&#8221; alt=&#8221;ARRAY_CONSTRAIN formula 6&#8243; title_text=&#8221;ARRAY_CONSTRAIN formula 6&#8243; _builder_version=&#8221;4.16&#8243; _module_preset=&#8221;default&#8221; global_colors_info=&#8221;{}&#8221; theme_builder_area=&#8221;post_content&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Google Sheets, the\u00a0ARRAY_CONSTRAIN\u00a0formula returns a subset of the input range, characterized by the specified number of rows and columns. In other words, the formula restricts or constraints the size of input range by the specified number of rows and columns. Syntax ARRAY_CONSTRAIN(input_range, num_rows, num_cols) input_range\u00a0\u2013 can either be an address reference to the range [&hellip;]<\/p>\n","protected":false},"author":40,"featured_media":4016,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_et_pb_use_builder":"on","_et_pb_old_content":"In Google Sheets, the <a href=\"https:\/\/support.google.com\/docs\/answer\/3267036?hl=en\" target=\"_blank\" rel=\"noopener\">ARRAY_CONSTRAIN<\/a> formula returns a subset of the input range, characterized by the specified number of rows and columns. In other words, the formula restricts or constraints the size of input range by the specified number of rows and columns.\n<h3>Syntax<\/h3>\n<span style=\"font-family: courier new,courier,monospace; font-size: 14pt;\"><strong>ARRAY_CONSTRAIN(input_range, num_rows, num_cols)<\/strong><\/span>\n<ul>\n \t<li><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>input_range<\/strong><\/span> - can either be an address reference to the range of cells that we need to constrain, or an output range derived from another formula.<\/li>\n \t<li><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>num_rows<\/strong><\/span> -is the number of rows the constrained should contain.<\/li>\n \t<li><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>num_cols<\/strong><\/span> - is the number of columns the constrained output should contain<\/li>\n<\/ul>\n<h3>Usage: ARRAY_CONSTRAIN Formula<\/h3>\nExamples always help us digest the concepts better. Following is a sample data set on which we will try the ARRAY_CONSTRAIN formula.\n\n<img class=\"aligncenter size-full wp-image-3950\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/10\/frame-generic-36.png\" alt=\"ARRAY_CONSTRAIN Formula - Illustration 1\" width=\"755\" height=\"267\" \/>\n\nNow, we keyed in the formula in cell H1, as shown in the snapshot below.\n\n<img class=\"aligncenter size-full wp-image-3951\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/10\/frame-generic-37.png\" alt=\"ARRAY_CONSTRAIN Formula - Illustration 2\" width=\"1153\" height=\"290\" \/>\n\nThe <span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>input_range<\/strong><\/span> is A1:G10, while the size defining parameters <span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>num_rows<\/strong><\/span> and <span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>num_columns<\/strong><\/span> are 7 and 4 respectively. We see that the output consists of 7 rows and 4 columns, exactly as we defined. It ignored the data falling beyond row 7 and column 4.\n\nThe output data flows from H1 towards right and further down. So, it is very important that we keep the cells, where we expect the data to flow, clear of any values. Otherwise, the formula returns #REF! error, as demonstrated in the screenshot below.\n\n<img class=\"aligncenter size-full wp-image-3953\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/10\/frame-generic-38.png\" alt=\"ARRAY_CONSTRAIN Formula - Illustration 3\" width=\"1160\" height=\"291\" \/>\n\nSuppose that we need only the Vegetables' data corresponding to Energy column only. Here's how we can get creative with the formula.\n\n<img class=\"aligncenter size-full wp-image-3954\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/10\/frame-generic-39.png\" alt=\"ARRAY_CONSTRAIN Formula - Illustration 4\" width=\"1057\" height=\"290\" \/>\n\nUnlike the previous example, we have entered the formula in H2 here. We considered only the data rows and not the header. The <a href=\"https:\/\/support.google.com\/docs\/answer\/3093197?hl=en\" target=\"_blank\" rel=\"noopener\">FILTER<\/a> formula evaluated the range for the first parameter, whereas the <a href=\"https:\/\/support.google.com\/docs\/answer\/3093480?hl=en\" target=\"_blank\" rel=\"noopener\">COUNTIF<\/a> formula determined the value for the second parameter.\n\nTo take this even further we can try this formula on the 'data import' related functions as well. For example, here is how a normal IMPORTDATA would have looked like.\n\n<img class=\"aligncenter size-full wp-image-3957\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/10\/frame-generic-40.png\" alt=\"ARRAY_CONSTRAIN Formula - Illustration 5\" width=\"1152\" height=\"502\" \/>\n\nIn the snapshot below, we embedded this within the ARRAY_CONSTRAIN formula. And, we constrained the data to 10 rows and 10 columns.\n\n<img class=\"aligncenter size-full wp-image-3958\" src=\"https:\/\/static.sheetgo.com\/wp-content\/uploads\/2017\/10\/frame-generic-41.png\" alt=\"ARRAY_CONSTRAIN Formula - Illustration 6\" width=\"1159\" height=\"262\" \/>\n\n&nbsp;","_et_gb_content_width":"","footnotes":""},"categories":[54],"tags":[39,28],"class_list":["post-3938","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-sheets-formulas","tag-connections-t","tag-spreadsheets"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/3938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/comments?post=3938"}],"version-history":[{"count":0,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/posts\/3938\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media\/4016"}],"wp:attachment":[{"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/media?parent=3938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/categories?post=3938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sheetgo.com\/pt\/wp-json\/wp\/v2\/tags?post=3938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}