X
X
xcandlelight2022-02-19 21:55:09
JavaScript
xcandlelight, 2022-02-19 21:55:09

How to insert data from one cell to another by selecting it dynamically?

Essence: there are 2 sheets, on one - 2 cells with data (A1 and A2), on the other - column B.
Task: if A1 > 0, put the data from A2 into the cell of column B in row A1 (i.e. pre-number cell is unknown, otherwise everything is clear).
Example:
on sheet 1 A1 = 2, A2 = 10, insert on sheet 2 in B2 the value 10
on sheet 1 A1 = 5, A2 = 10, insert on sheet 2 in B5 the value 10

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Belyaev, 2016-03-16
@bingo347

For find, the 1st parameter is responsible for the conditions, the returned fields determine the 2nd parameter, but if it is present, all other fields of the document will be absent, you can of course list them, but this will have to be changed when changing the structure of the document, example:

var locale = i18n.getLocale();
 Article.find({}, {
    ['title.' + locale]: 1,
    ['content.' + locale]: 1
})

The second option is to convert the result from the base as you need, example:
var locale = i18n.getLocale();
Article.find().sort('-   created').populate('user', 'displayName').exec(function (err, articles) {
  if (err) {
    return res.status(400).send({
      message: errorHandler.getErrorMessage(err)
    });
  } else {
     articles.forEach(article => {
       article.title = article.title[locale];
       article.content = article.content[locale];
     });
     res.json(articles);
  }
});

X
xcandlelight, 2022-02-21
@xcandlelight

I decided this way - I numbered column A on the second sheet (in real conditions it was already numbered) and inserted the formula = {"Column name" into B1; ArrayFormula(IF('Sheet 1'!A$1=A2:A;'Sheet 1'!A$2;))}

A
Aleksei Shebanits, 2022-02-20
@shebanits

=IF('Sheet1'!A1>0;'Sheet1'!A2;"No")
621273ca1759a060589395.png
621273e6436e5133361658.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question