-3

I have a VLOOKUP formula and the result can be either a number or a percentage (this can even vary for the same cell depending on the value given by a drop-down list).

How can the format of the cell be automatically updated depending on the format of the "mother" cell?

pnuts
  • 58,317
  • 11
  • 87
  • 139
N. Pavon
  • 821
  • 4
  • 15
  • 32
  • Can you post the formula and some sample data? Will you number ever be between 0 and 1? If not, then just wrap an `If` statement around the `Vlookup` to check the outcome, and use `TEXT()` on the result? – BruceWayne Aug 02 '17 at 21:43
  • 1
    You will need to do conditional formatting on the cell with the formula. – Scott Craner Aug 02 '17 at 21:43
  • Formulas in and of themselves cannot read and/or set the format of a cell. The method described by @BruceWayne will not set the format of the cell but change the number to text that looks like the correct number format. It may work for you. – Scott Craner Aug 02 '17 at 21:49
  • @ScottCraner - Can you do a conditional format that just follows another cell's format? I'm thinking of say `=CELL("format",A1)` to apply to `B1`? – BruceWayne Aug 02 '17 at 21:58
  • @pnuts man y'all are dancing around an answer so I can't wait for more attempts/info from OP (\*cough cough hint hint\*) and someone can show me what y'all mean! : D – BruceWayne Aug 03 '17 at 03:24

1 Answers1

2

A simplified example (since OP has not provided details):

SO45471455 example

The CF formula rule is:

=CELL("format",INDIRECT(ADDRESS(MATCH(A9,H:H,0),9)))="P0"

and the format chosen Percentage (with decimal places set to 0).

pnuts
  • 58,317
  • 11
  • 87
  • 139