O
O
orfs2022-01-17 16:13:15
excel
orfs, 2022-01-17 16:13:15

Autocomplete between two values?

There is a price list of auto parts in csv format. Automotive theme. I have two columns:

  1. in one is the year of the start of production of the car model,
  2. in another year, the release of the car model is completed (or an empty field if the model is in production).

I need to collect these release years in one more column in the full range from and to (and if the value is empty, then specify the value 2022):

Example:

Column (start year), value in the line: 2005
Column (end year), value in line: 2009 It is

necessary to form a type column for each line: 2005, 2006, 2007, 2008, 2009.

If the year of completion is empty in the cell, then specify: 2022.

In general, so that values ​​​​separated by commas are generated in the year of issue column.

Is it possible to do this task with some macro or function? Or is there some alternative possible?

(I am compiling a price list for uploading to woocomerce.)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2022-01-18
@ForestAndGarden

For Excel with little checks and a year based on the current date.
Formula in cell C2:

=
ЕСЛИ(
    ИЛИ(И(A2="";B2="");И(B2<>"";B2<A2))
    ;"?!"
    ;ЕСЛИОШИБКА(
        ОБЪЕДИНИТЬ(
            ", "
            ;1
            ;ПОСЛЕД(
                1
                ;ЕСЛИ(
                    B2=""
                    ;ГОД(СЕГОДНЯ())-A2+1
                    ;B2-A2+1
                )
                ;A2
            )
        )
        ;"-"
    )
)

For Google Sheets , the formula in cell C2 is:
=ЕСЛИ(ИЛИ(И(A2="";B2="");И(B2<>"";B2<A2));"?!";ЕСЛИОШИБКА(JOIN(", ";SEQUENCE(1;ЕСЛИ(B2="";ГОД(СЕГОДНЯ())-A2+1;B2-A2+1);A2));"–"))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question