Home > database >  Change the value of a column from a list of data according to the column next to it
Change the value of a column from a list of data according to the column next to it

Time:10-06

I have an import file in Excel format and it contains several data to import on a website. Globally the columns are represented as follows

Post-title Post-Category Post-Image
Line 45 train train_1.png
Line 59 train train_2.png
Line 67 train train_3.png
Line 87 train train_1.png
Express 45 bus bus_1.png
AirPort Shuttle bus bus_2.png

As you can see, the last column is the column of the highlighted image. I have a list of images that are related to my categories, here is an example

Category Image
train train_1.png
train train_2.png
train train_3.png
bus bus_1.png
bus bus_2.png
bus bus_3.png

Basically, I would like to know if it is possible that when I put the category "Train" there is an image of train among the list that I have (in a random way so as not to always have the same). Because currently I have to process all my rows manually and change the value of the image column manually.

I don't know where to start looking, do you have any leads to help me get started?

CodePudding user response:

Have a try with:

enter image description here

Formula in C2:

=@SORTBY(FILTER(F$2:F$7,E$2:E$7=B2),RANDARRAY(COUNTIF(E$2:E$7,B2)))

Note that RANDARRAY() is volatile though.

  • Related