Excel spread sheet if statement -
i'm working on excel spreadsheet , want if statement in cell allows user input if condition met, , calculates value otherwise.
=if(condition true, whatever user wants, 5*$a$1,)
is there way this?
you won't able have user-input in same cell formula. (without using vba)
to without vba need use @ least 2 cells, 1 formula, , 1 user value
there couple of ways can vba
heres simple one, not recomment it, if lots of cells use you'll lots of inputboxes!
usage: =if(condition, userinput(), false result)
public function userinput() integer ' used integer example dim result variant result = application.inputbox("enter integer", "input required", , , , , , 1) ' inputbox, final 1 makes accept numbers if vartype(result) = vbboolean userinput = 0 ' default value else userinput = cint(result) ' make sure integer end if end function
another one, involve using selection change , cell change events read initial value of cell being changed, , allow change (adding value initial formula's "true" block or deny changes reverting cells formula initial one.
Comments
Post a Comment