Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

tiredtoo

(2,949 posts)
Sun Apr 11, 2021, 02:04 PM Apr 2021

Changing values in formulas based on calculations

I am using Concatenate to select 4 different cells. this function is used up to 10 times with each time stepping down 1 row. Works fine when I have 40 rows of data but, sometimes i only have 29 rows of data. Example of my formula below.

=CONCATENATE(B2,", ",B9,", ",B16,", ",B23)
=CONCATENATE(B3,", ",B10,", ",B17,", ",B24)
and so on...
Now is there anyway i can automatically change the cells in the formula base on the number of rows used in the spreadsheet?

Not an expert at excel but i stumble along.

7 replies = new reply since forum marked as read
Highlight: NoneDon't highlight anything 5 newestHighlight 5 most recent replies
Changing values in formulas based on calculations (Original Post) tiredtoo Apr 2021 OP
If there is I would love to know WA-03 Democrat Apr 2021 #1
This message was self-deleted by its author padfun Apr 2021 #2
Yes. There should be a ROWS function. padfun Apr 2021 #3
Try this Shermann Apr 2021 #4
More... padfun Apr 2021 #5
OK, Shermanns answer is probably best for you padfun Apr 2021 #6
Thank you all for the advice but, tiredtoo Apr 2021 #7

WA-03 Democrat

(3,271 posts)
1. If there is I would love to know
Sun Apr 11, 2021, 02:08 PM
Apr 2021

You are doing it the only way I know how. Pick each cell for the function.

Response to tiredtoo (Original post)

padfun

(1,857 posts)
3. Yes. There should be a ROWS function.
Sun Apr 11, 2021, 02:36 PM
Apr 2021

I you would need to make a variable and then have that assigned the Rows number, then use the viable in the concatenate function.

It would be easiest to code it in VBA instead and excel uses VBA very well


But later today, when I get back to my house, I can look at my excel and find it for you. And give you the right syntax.

Shermann

(8,682 posts)
4. Try this
Sun Apr 11, 2021, 03:43 PM
Apr 2021

=CONCATENATE(B2,IF(ISBLANK(B9), "", ", " ), B9,IF(ISBLANK(B16), "", ", " ), B16,IF(ISBLANK(B23), "", ", " ), B23)

It looks for blanks and adds the commas as necessary. The B2 row can't be blank but B9,B16,and B23 can be. You can extend the formula to the maximum number of columns possible and use the same formula for every row.

padfun

(1,857 posts)
5. More...
Sun Apr 11, 2021, 05:39 PM
Apr 2021

Here is a link on using the ROWS function:
https://exceljet.net/excel-functions/excel-row-function

When using it in concatenate, Use the syntax B + {variable name} and it should still take you to that cell.
In VBA I use this with the CELLS function like this CELLS(Variable, B). You can even loop it and have it go to each Row in a column.

If you don't know VBA, it is worth exploring. It really isnt that hard and much if it is similar to what you put into a cell. You can google examples and use them in your spreadsheet. Eventually you find yourself just using them without looking them up.

tiredtoo

(2,949 posts)
7. Thank you all for the advice but,
Sun Apr 11, 2021, 09:25 PM
Apr 2021

It appears my question was not really correct. I have a spread sheet with data in between 20 and 40 rows. Once all the data is entered I separate it into 4 equal sets. If each set has 10 rows the B2, B9, B16, b23 works fine. however if the number of rows is smaller, a smaller gap between rows would work better. ie B2, B6, B10, B14. The B2 is always the beginning row. It is the B9 to B6 etc. I would like to find a way to do it without manually changing them.
Again thank you for your support. Not sure how to write a visual program in excel. I know macros are in VB but that's all.

Latest Discussions»Culture Forums»Apple Users»Changing values in formul...