Forum Discussion

Kylod's avatar
Kylod
Copper Contributor
Mar 08, 2019

Filling a cell on condition

Hi,

I am creating a spreadsheet for work that calculates profit margin.

I have a cell to enter the sell price for each unit. I also have 2 cells to enter multi buy eg. First cell input quantity, second cell input price separated by text 'for' (2 for $3).
What I want to do is if input is entered in 'price per unit' then calculate this. But if multi buy cells are used then calculate the per unit result and display this in the 'price per unit' cell.

So far I have a formula cell which I'll hide that checks if the multi buy cell is blank & if it is it makes a calc based on what is in the per unit cell. If it isn't it makes the calc based on what is entered in multi buy cells but I can't then get it to display the unit price in the price per unit cell.

Any help would be appreciated.

3 Replies

  • Twifoo's avatar
    Twifoo
    Silver Contributor
    I suggest that the labels in A1:F1 should be Qty, QtyforPrice, SaleQty, Price, UnitPrice, and TotalSale, respectively.
    In C2, the formula is:
    =IF(B2=“”,
    A2,
    —LEFT(B2,FIND(“ for $“,B2)-1))
    In E2, the formula is:
    =IF(B2=“”,
    D2,
    —RIGHT(B2,LEN(B2)-FIND(“ for $”,B2)-5))
    In F2, the formula is:
    =C2*E2
      • Twifoo's avatar
        Twifoo
        Silver Contributor
        Go ahead, then update of your thoughts thereon.

Resources