Excel Formula - Add cell + “.jpg” based on value i

2019-07-25 09:16发布

问题:

I hope someone can assist with this issue I can't solve.

I have an excel sheet that I want to automatically add a specific value based on a cell's SkU number and add a .jpg extension to that SKU in another cell automatically

Basically if there is a value in cell B2 and C2 is blank I want to automatically add in column I the value from B2 + .jpg Then also add in column M (a static value) Color::1|Size::2

Right now I have a simple formula in Column I =B2&".jpg"

    B                  C                  I                 M
product_sku     product_parent_sku  product_full_image  attributes
ABC-0001                            ABC-0001.jpg        Color::1|Size::2
ABC-0001        ABC-0001-1      
ABC-0001        ABC-0001-2      
ABC-0002                            ABC-0002.jpg        Color::1|Size::2

回答1:

Suggest either nested IF statements or an IF statement with an AND condition in I2:-

=IF(B2="","",IF(C2="",B2&".jpg",""))

or

=IF(AND(B2<>"",C2=""),B2&".jpg","")

Then M2 is only filled in if I2 is filled in:-

=IF(I2="","","Color::1|Size::2")

Pull the formulae down as required.



回答2:

=IF(AND(ISBLANK(B2)=FALSE,ISBLANK(C2)),B2 & ".jpg","") =IF(AND(ISBLANK(B2)=FALSE,ISBLANK(C2)),"Color::1|Size::2","")