• 460K Members
• 10.2K Online
• 558K Conversations

New Contributor

# 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

# Re: Filling a cell on condition

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

# Re: Filling a cell on condition

Thanks. I'll give this a try.

# Re: Filling a cell on condition

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies